{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Gst.Functions
    (

 -- * Methods
-- ** debugAddLogFunction #method:debugAddLogFunction#

    debugAddLogFunction                     ,


-- ** debugAddRingBufferLogger #method:debugAddRingBufferLogger#

    debugAddRingBufferLogger                ,


-- ** debugBinToDotData #method:debugBinToDotData#

    debugBinToDotData                       ,


-- ** debugBinToDotFile #method:debugBinToDotFile#

    debugBinToDotFile                       ,


-- ** debugBinToDotFileWithTs #method:debugBinToDotFileWithTs#

    debugBinToDotFileWithTs                 ,


-- ** debugConstructTermColor #method:debugConstructTermColor#

    debugConstructTermColor                 ,


-- ** debugConstructWinColor #method:debugConstructWinColor#

    debugConstructWinColor                  ,


-- ** debugGetAllCategories #method:debugGetAllCategories#

    debugGetAllCategories                   ,


-- ** debugGetColorMode #method:debugGetColorMode#

    debugGetColorMode                       ,


-- ** debugGetDefaultThreshold #method:debugGetDefaultThreshold#

    debugGetDefaultThreshold                ,


-- ** debugGetStackTrace #method:debugGetStackTrace#

    debugGetStackTrace                      ,


-- ** debugIsActive #method:debugIsActive#

    debugIsActive                           ,


-- ** debugIsColored #method:debugIsColored#

    debugIsColored                          ,


-- ** debugLogDefault #method:debugLogDefault#

    debugLogDefault                         ,


-- ** debugPrintStackTrace #method:debugPrintStackTrace#

    debugPrintStackTrace                    ,


-- ** debugRemoveLogFunction #method:debugRemoveLogFunction#

    debugRemoveLogFunction                  ,


-- ** debugRemoveLogFunctionByData #method:debugRemoveLogFunctionByData#

    debugRemoveLogFunctionByData            ,


-- ** debugRemoveRingBufferLogger #method:debugRemoveRingBufferLogger#

    debugRemoveRingBufferLogger             ,


-- ** debugRingBufferLoggerGetLogs #method:debugRingBufferLoggerGetLogs#

    debugRingBufferLoggerGetLogs            ,


-- ** debugSetActive #method:debugSetActive#

    debugSetActive                          ,


-- ** debugSetColorMode #method:debugSetColorMode#

    debugSetColorMode                       ,


-- ** debugSetColorModeFromString #method:debugSetColorModeFromString#

    debugSetColorModeFromString             ,


-- ** debugSetColored #method:debugSetColored#

    debugSetColored                         ,


-- ** debugSetDefaultThreshold #method:debugSetDefaultThreshold#

    debugSetDefaultThreshold                ,


-- ** debugSetThresholdForName #method:debugSetThresholdForName#

    debugSetThresholdForName                ,


-- ** debugSetThresholdFromString #method:debugSetThresholdFromString#

    debugSetThresholdFromString             ,


-- ** debugUnsetThresholdForName #method:debugUnsetThresholdForName#

    debugUnsetThresholdForName              ,


-- ** deinit #method:deinit#

    deinit                                  ,


-- ** dynamicTypeRegister #method:dynamicTypeRegister#

    dynamicTypeRegister                     ,


-- ** errorGetMessage #method:errorGetMessage#

    errorGetMessage                         ,


-- ** filenameToUri #method:filenameToUri#

    filenameToUri                           ,


-- ** flowGetName #method:flowGetName#

    flowGetName                             ,


-- ** flowToQuark #method:flowToQuark#

    flowToQuark                             ,


-- ** formatsContains #method:formatsContains#

    formatsContains                         ,


-- ** getMainExecutablePath #method:getMainExecutablePath#

    getMainExecutablePath                   ,


-- ** init #method:init#

    init                                    ,


-- ** initCheck #method:initCheck#

    initCheck                               ,


-- ** isCapsFeatures #method:isCapsFeatures#

    isCapsFeatures                          ,


-- ** isInitialized #method:isInitialized#

    isInitialized                           ,


-- ** paramSpecArray #method:paramSpecArray#

    paramSpecArray                          ,


-- ** paramSpecFraction #method:paramSpecFraction#

    paramSpecFraction                       ,


-- ** parentBufferMetaApiGetType #method:parentBufferMetaApiGetType#

    parentBufferMetaApiGetType              ,


-- ** parseBinFromDescription #method:parseBinFromDescription#

    parseBinFromDescription                 ,


-- ** parseBinFromDescriptionFull #method:parseBinFromDescriptionFull#

    parseBinFromDescriptionFull             ,


-- ** parseLaunch #method:parseLaunch#

    parseLaunch                             ,


-- ** parseLaunchFull #method:parseLaunchFull#

    parseLaunchFull                         ,


-- ** parseLaunchv #method:parseLaunchv#

    parseLaunchv                            ,


-- ** parseLaunchvFull #method:parseLaunchvFull#

    parseLaunchvFull                        ,


-- ** protectionFilterSystemsByAvailableDecryptors #method:protectionFilterSystemsByAvailableDecryptors#

    protectionFilterSystemsByAvailableDecryptors,


-- ** protectionMetaApiGetType #method:protectionMetaApiGetType#

    protectionMetaApiGetType                ,


-- ** protectionSelectSystem #method:protectionSelectSystem#

    protectionSelectSystem                  ,


-- ** referenceTimestampMetaApiGetType #method:referenceTimestampMetaApiGetType#

    referenceTimestampMetaApiGetType        ,


-- ** segtrapIsEnabled #method:segtrapIsEnabled#

    segtrapIsEnabled                        ,


-- ** segtrapSetEnabled #method:segtrapSetEnabled#

    segtrapSetEnabled                       ,


-- ** staticCapsGetType #method:staticCapsGetType#

    staticCapsGetType                       ,


-- ** staticPadTemplateGetType #method:staticPadTemplateGetType#

    staticPadTemplateGetType                ,


-- ** tagExists #method:tagExists#

    tagExists                               ,


-- ** tagGetDescription #method:tagGetDescription#

    tagGetDescription                       ,


-- ** tagGetFlag #method:tagGetFlag#

    tagGetFlag                              ,


-- ** tagGetNick #method:tagGetNick#

    tagGetNick                              ,


-- ** tagGetType #method:tagGetType#

    tagGetType                              ,


-- ** tagIsFixed #method:tagIsFixed#

    tagIsFixed                              ,


-- ** tagMergeStringsWithComma #method:tagMergeStringsWithComma#

    tagMergeStringsWithComma                ,


-- ** tagMergeUseFirst #method:tagMergeUseFirst#

    tagMergeUseFirst                        ,


-- ** typeFindGetType #method:typeFindGetType#

    typeFindGetType                         ,


-- ** updateRegistry #method:updateRegistry#

    updateRegistry                          ,


-- ** utilArrayBinarySearch #method:utilArrayBinarySearch#

    utilArrayBinarySearch                   ,


-- ** utilDoubleToFraction #method:utilDoubleToFraction#

    utilDoubleToFraction                    ,


-- ** utilDumpBuffer #method:utilDumpBuffer#

    utilDumpBuffer                          ,


-- ** utilDumpMem #method:utilDumpMem#

    utilDumpMem                             ,


-- ** utilFractionAdd #method:utilFractionAdd#

    utilFractionAdd                         ,


-- ** utilFractionCompare #method:utilFractionCompare#

    utilFractionCompare                     ,


-- ** utilFractionMultiply #method:utilFractionMultiply#

    utilFractionMultiply                    ,


-- ** utilFractionToDouble #method:utilFractionToDouble#

    utilFractionToDouble                    ,


-- ** utilGdoubleToGuint64 #method:utilGdoubleToGuint64#

    utilGdoubleToGuint64                    ,


-- ** utilGetObjectArray #method:utilGetObjectArray#

    utilGetObjectArray                      ,


-- ** utilGetTimestamp #method:utilGetTimestamp#

    utilGetTimestamp                        ,


-- ** utilGreatestCommonDivisor #method:utilGreatestCommonDivisor#

    utilGreatestCommonDivisor               ,


-- ** utilGreatestCommonDivisorInt64 #method:utilGreatestCommonDivisorInt64#

    utilGreatestCommonDivisorInt64          ,


-- ** utilGroupIdNext #method:utilGroupIdNext#

    utilGroupIdNext                         ,


-- ** utilGuint64ToGdouble #method:utilGuint64ToGdouble#

    utilGuint64ToGdouble                    ,


-- ** utilSeqnumCompare #method:utilSeqnumCompare#

    utilSeqnumCompare                       ,


-- ** utilSeqnumNext #method:utilSeqnumNext#

    utilSeqnumNext                          ,


-- ** utilSetObjectArg #method:utilSetObjectArg#

    utilSetObjectArg                        ,


-- ** utilSetObjectArray #method:utilSetObjectArray#

    utilSetObjectArray                      ,


-- ** utilSetValueFromString #method:utilSetValueFromString#

    utilSetValueFromString                  ,


-- ** utilUint64Scale #method:utilUint64Scale#

    utilUint64Scale                         ,


-- ** utilUint64ScaleCeil #method:utilUint64ScaleCeil#

    utilUint64ScaleCeil                     ,


-- ** utilUint64ScaleInt #method:utilUint64ScaleInt#

    utilUint64ScaleInt                      ,


-- ** utilUint64ScaleIntCeil #method:utilUint64ScaleIntCeil#

    utilUint64ScaleIntCeil                  ,


-- ** utilUint64ScaleIntRound #method:utilUint64ScaleIntRound#

    utilUint64ScaleIntRound                 ,


-- ** utilUint64ScaleRound #method:utilUint64ScaleRound#

    utilUint64ScaleRound                    ,


-- ** valueCanCompare #method:valueCanCompare#

    valueCanCompare                         ,


-- ** valueCanIntersect #method:valueCanIntersect#

    valueCanIntersect                       ,


-- ** valueCanSubtract #method:valueCanSubtract#

    valueCanSubtract                        ,


-- ** valueCanUnion #method:valueCanUnion#

    valueCanUnion                           ,


-- ** valueCompare #method:valueCompare#

    valueCompare                            ,


-- ** valueDeserialize #method:valueDeserialize#

    valueDeserialize                        ,


-- ** valueFixate #method:valueFixate#

    valueFixate                             ,


-- ** valueFractionMultiply #method:valueFractionMultiply#

    valueFractionMultiply                   ,


-- ** valueFractionSubtract #method:valueFractionSubtract#

    valueFractionSubtract                   ,


-- ** valueGetBitmask #method:valueGetBitmask#

    valueGetBitmask                         ,


-- ** valueGetCaps #method:valueGetCaps#

    valueGetCaps                            ,


-- ** valueGetCapsFeatures #method:valueGetCapsFeatures#

    valueGetCapsFeatures                    ,


-- ** valueGetDoubleRangeMax #method:valueGetDoubleRangeMax#

    valueGetDoubleRangeMax                  ,


-- ** valueGetDoubleRangeMin #method:valueGetDoubleRangeMin#

    valueGetDoubleRangeMin                  ,


-- ** valueGetFlagsetFlags #method:valueGetFlagsetFlags#

    valueGetFlagsetFlags                    ,


-- ** valueGetFlagsetMask #method:valueGetFlagsetMask#

    valueGetFlagsetMask                     ,


-- ** valueGetFractionDenominator #method:valueGetFractionDenominator#

    valueGetFractionDenominator             ,


-- ** valueGetFractionNumerator #method:valueGetFractionNumerator#

    valueGetFractionNumerator               ,


-- ** valueGetFractionRangeMax #method:valueGetFractionRangeMax#

    valueGetFractionRangeMax                ,


-- ** valueGetFractionRangeMin #method:valueGetFractionRangeMin#

    valueGetFractionRangeMin                ,


-- ** valueGetInt64RangeMax #method:valueGetInt64RangeMax#

    valueGetInt64RangeMax                   ,


-- ** valueGetInt64RangeMin #method:valueGetInt64RangeMin#

    valueGetInt64RangeMin                   ,


-- ** valueGetInt64RangeStep #method:valueGetInt64RangeStep#

    valueGetInt64RangeStep                  ,


-- ** valueGetIntRangeMax #method:valueGetIntRangeMax#

    valueGetIntRangeMax                     ,


-- ** valueGetIntRangeMin #method:valueGetIntRangeMin#

    valueGetIntRangeMin                     ,


-- ** valueGetIntRangeStep #method:valueGetIntRangeStep#

    valueGetIntRangeStep                    ,


-- ** valueGetStructure #method:valueGetStructure#

    valueGetStructure                       ,


-- ** valueInitAndCopy #method:valueInitAndCopy#

    valueInitAndCopy                        ,


-- ** valueIntersect #method:valueIntersect#

    valueIntersect                          ,


-- ** valueIsFixed #method:valueIsFixed#

    valueIsFixed                            ,


-- ** valueIsSubset #method:valueIsSubset#

    valueIsSubset                           ,


-- ** valueRegister #method:valueRegister#

    valueRegister                           ,


-- ** valueSerialize #method:valueSerialize#

    valueSerialize                          ,


-- ** valueSetBitmask #method:valueSetBitmask#

    valueSetBitmask                         ,


-- ** valueSetCaps #method:valueSetCaps#

    valueSetCaps                            ,


-- ** valueSetCapsFeatures #method:valueSetCapsFeatures#

    valueSetCapsFeatures                    ,


-- ** valueSetDoubleRange #method:valueSetDoubleRange#

    valueSetDoubleRange                     ,


-- ** valueSetFlagset #method:valueSetFlagset#

    valueSetFlagset                         ,


-- ** valueSetFraction #method:valueSetFraction#

    valueSetFraction                        ,


-- ** valueSetFractionRange #method:valueSetFractionRange#

    valueSetFractionRange                   ,


-- ** valueSetFractionRangeFull #method:valueSetFractionRangeFull#

    valueSetFractionRangeFull               ,


-- ** valueSetInt64Range #method:valueSetInt64Range#

    valueSetInt64Range                      ,


-- ** valueSetInt64RangeStep #method:valueSetInt64RangeStep#

    valueSetInt64RangeStep                  ,


-- ** valueSetIntRange #method:valueSetIntRange#

    valueSetIntRange                        ,


-- ** valueSetIntRangeStep #method:valueSetIntRangeStep#

    valueSetIntRangeStep                    ,


-- ** valueSetStructure #method:valueSetStructure#

    valueSetStructure                       ,


-- ** valueSubtract #method:valueSubtract#

    valueSubtract                           ,


-- ** valueUnion #method:valueUnion#

    valueUnion                              ,


-- ** version #method:version#

    version                                 ,


-- ** versionString #method:versionString#

    versionString                           ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Flags as GObject.Flags
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.GObject.Structs.ValueArray as GObject.ValueArray
import qualified GI.Gst.Callbacks as Gst.Callbacks
import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Flags as Gst.Flags
import {-# SOURCE #-} qualified GI.Gst.Objects.Bin as Gst.Bin
import {-# SOURCE #-} qualified GI.Gst.Objects.Element as Gst.Element
import {-# SOURCE #-} qualified GI.Gst.Objects.Plugin as Gst.Plugin
import {-# SOURCE #-} qualified GI.Gst.Structs.Buffer as Gst.Buffer
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.CapsFeatures as Gst.CapsFeatures
import {-# SOURCE #-} qualified GI.Gst.Structs.DebugCategory as Gst.DebugCategory
import {-# SOURCE #-} qualified GI.Gst.Structs.DebugMessage as Gst.DebugMessage
import {-# SOURCE #-} qualified GI.Gst.Structs.ParseContext as Gst.ParseContext
import {-# SOURCE #-} qualified GI.Gst.Structs.Structure as Gst.Structure
import {-# SOURCE #-} qualified GI.Gst.Structs.ValueTable as Gst.ValueTable

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

foreign import ccall "gst_version_string" gst_version_string ::
    IO CString

{- |
This function returns a string that is useful for describing this version
of GStreamer to the outside world: user agent strings, logging, ...
-}
versionString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    {- ^ __Returns:__ a newly allocated string describing this version
    of GStreamer. -}
versionString  = liftIO $ do
    result <- gst_version_string
    checkUnexpectedReturnNULL "versionString" result
    result' <- cstringToText result
    freeMem result
    return result'


-- function gst_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", 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", 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", 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", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_version" gst_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 library.
-}
version ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ((Word32, Word32, Word32, Word32))
version  = liftIO $ do
    major <- allocMem :: IO (Ptr Word32)
    minor <- allocMem :: IO (Ptr Word32)
    micro <- allocMem :: IO (Ptr Word32)
    nano <- allocMem :: IO (Ptr Word32)
    gst_version major minor micro nano
    major' <- peek major
    minor' <- peek minor
    micro' <- peek micro
    nano' <- peek nano
    freeMem major
    freeMem minor
    freeMem micro
    freeMem nano
    return (major', minor', micro', nano')


-- function gst_value_union
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the destination value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value to union", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "another value to union", 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_value_union" gst_value_union ::
    Ptr GValue ->                           -- dest : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- value1 : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- value2 : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Creates a GValue corresponding to the union of /@value1@/ and /@value2@/.
-}
valueUnion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value1@/: a value to union -}
    -> GValue
    {- ^ /@value2@/: another value to union -}
    -> m ((Bool, GValue))
    {- ^ __Returns:__ 'True' if the union succeeded. -}
valueUnion value1 value2 = liftIO $ do
    dest <- callocBoxedBytes 24 :: IO (Ptr GValue)
    value1' <- unsafeManagedPtrGetPtr value1
    value2' <- unsafeManagedPtrGetPtr value2
    result <- gst_value_union dest value1' value2'
    let result' = (/= 0) result
    dest' <- (wrapBoxed GValue) dest
    touchManagedPtr value1
    touchManagedPtr value2
    return (result', dest')


-- function gst_value_subtract
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the destination value\n    for the result if the subtraction is not empty. May be %NULL,\n    in which case the resulting set will not be computed, which can\n    give a fair speedup.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "minuend", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value to subtract from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "subtrahend", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value to subtract", 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_value_subtract" gst_value_subtract ::
    Ptr GValue ->                           -- dest : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- minuend : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- subtrahend : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Subtracts /@subtrahend@/ from /@minuend@/ and stores the result in /@dest@/.
Note that this means subtraction as in sets, not as in mathematics.
-}
valueSubtract ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@minuend@/: the value to subtract from -}
    -> GValue
    {- ^ /@subtrahend@/: the value to subtract -}
    -> m ((Bool, GValue))
    {- ^ __Returns:__ 'True' if the subtraction is not empty -}
valueSubtract minuend subtrahend = liftIO $ do
    dest <- callocBoxedBytes 24 :: IO (Ptr GValue)
    minuend' <- unsafeManagedPtrGetPtr minuend
    subtrahend' <- unsafeManagedPtrGetPtr subtrahend
    result <- gst_value_subtract dest minuend' subtrahend'
    let result' = (/= 0) result
    dest' <- (wrapBoxed GValue) dest
    touchManagedPtr minuend
    touchManagedPtr subtrahend
    return (result', dest')


-- function gst_value_set_structure
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_STRUCTURE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the structure to set the value to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_structure" gst_value_set_structure ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr Gst.Structure.Structure ->          -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Sets the contents of /@value@/ to /@structure@/.
-}
valueSetStructure ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_STRUCTURE -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the structure to set the value to -}
    -> m ()
valueSetStructure value structure = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    structure' <- unsafeManagedPtrGetPtr structure
    gst_value_set_structure value' structure'
    touchManagedPtr value
    touchManagedPtr structure
    return ()


-- function gst_value_set_int_range_step
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the end of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "step", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the step of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_int_range_step" gst_value_set_int_range_step ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Int32 ->                                -- start : TBasicType TInt
    Int32 ->                                -- end : TBasicType TInt
    Int32 ->                                -- step : TBasicType TInt
    IO ()

{- |
Sets /@value@/ to the range specified by /@start@/, /@end@/ and /@step@/.
-}
valueSetIntRangeStep ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT_RANGE -}
    -> Int32
    {- ^ /@start@/: the start of the range -}
    -> Int32
    {- ^ /@end@/: the end of the range -}
    -> Int32
    {- ^ /@step@/: the step of the range -}
    -> m ()
valueSetIntRangeStep value start end step = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    gst_value_set_int_range_step value' start end step
    touchManagedPtr value
    return ()


-- function gst_value_set_int_range
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the end of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_int_range" gst_value_set_int_range ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Int32 ->                                -- start : TBasicType TInt
    Int32 ->                                -- end : TBasicType TInt
    IO ()

{- |
Sets /@value@/ to the range specified by /@start@/ and /@end@/.
-}
valueSetIntRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT_RANGE -}
    -> Int32
    {- ^ /@start@/: the start of the range -}
    -> Int32
    {- ^ /@end@/: the end of the range -}
    -> m ()
valueSetIntRange value start end = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    gst_value_set_int_range value' start end
    touchManagedPtr value
    return ()


-- function gst_value_set_int64_range_step
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT64_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the end of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "step", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the step of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_int64_range_step" gst_value_set_int64_range_step ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Int64 ->                                -- start : TBasicType TInt64
    Int64 ->                                -- end : TBasicType TInt64
    Int64 ->                                -- step : TBasicType TInt64
    IO ()

{- |
Sets /@value@/ to the range specified by /@start@/, /@end@/ and /@step@/.
-}
valueSetInt64RangeStep ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT64_RANGE -}
    -> Int64
    {- ^ /@start@/: the start of the range -}
    -> Int64
    {- ^ /@end@/: the end of the range -}
    -> Int64
    {- ^ /@step@/: the step of the range -}
    -> m ()
valueSetInt64RangeStep value start end step = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    gst_value_set_int64_range_step value' start end step
    touchManagedPtr value
    return ()


-- function gst_value_set_int64_range
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT64_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the end of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_int64_range" gst_value_set_int64_range ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Int64 ->                                -- start : TBasicType TInt64
    Int64 ->                                -- end : TBasicType TInt64
    IO ()

{- |
Sets /@value@/ to the range specified by /@start@/ and /@end@/.
-}
valueSetInt64Range ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT64_RANGE -}
    -> Int64
    {- ^ /@start@/: the start of the range -}
    -> Int64
    {- ^ /@end@/: the end of the range -}
    -> m ()
valueSetInt64Range value start end = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    gst_value_set_int64_range value' start end
    touchManagedPtr value
    return ()


-- function gst_value_set_fraction_range_full
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_FRACTION_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "numerator_start", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the numerator start of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "denominator_start", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the denominator start of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "numerator_end", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the numerator end of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "denominator_end", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the denominator end of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_fraction_range_full" gst_value_set_fraction_range_full ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Int32 ->                                -- numerator_start : TBasicType TInt
    Int32 ->                                -- denominator_start : TBasicType TInt
    Int32 ->                                -- numerator_end : TBasicType TInt
    Int32 ->                                -- denominator_end : TBasicType TInt
    IO ()

{- |
Sets /@value@/ to the range specified by /@numeratorStart@/\//@denominatorStart@/
and /@numeratorEnd@/\//@denominatorEnd@/.
-}
valueSetFractionRangeFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_FRACTION_RANGE -}
    -> Int32
    {- ^ /@numeratorStart@/: the numerator start of the range -}
    -> Int32
    {- ^ /@denominatorStart@/: the denominator start of the range -}
    -> Int32
    {- ^ /@numeratorEnd@/: the numerator end of the range -}
    -> Int32
    {- ^ /@denominatorEnd@/: the denominator end of the range -}
    -> m ()
valueSetFractionRangeFull value numeratorStart denominatorStart numeratorEnd denominatorEnd = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    gst_value_set_fraction_range_full value' numeratorStart denominatorStart numeratorEnd denominatorEnd
    touchManagedPtr value
    return ()


-- function gst_value_set_fraction_range
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_FRACTION_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start of the range (a GST_TYPE_FRACTION GValue)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the end of the range (a GST_TYPE_FRACTION GValue)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_fraction_range" gst_value_set_fraction_range ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- start : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- end : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
Sets /@value@/ to the range specified by /@start@/ and /@end@/.
-}
valueSetFractionRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_FRACTION_RANGE -}
    -> GValue
    {- ^ /@start@/: the start of the range (a GST_TYPE_FRACTION GValue) -}
    -> GValue
    {- ^ /@end@/: the end of the range (a GST_TYPE_FRACTION GValue) -}
    -> m ()
valueSetFractionRange value start end = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    start' <- unsafeManagedPtrGetPtr start
    end' <- unsafeManagedPtrGetPtr end
    gst_value_set_fraction_range value' start' end'
    touchManagedPtr value
    touchManagedPtr start
    touchManagedPtr end
    return ()


-- function gst_value_set_fraction
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FRACTION", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "numerator", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the numerator of the fraction", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "denominator", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the denominator of the fraction", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_fraction" gst_value_set_fraction ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Int32 ->                                -- numerator : TBasicType TInt
    Int32 ->                                -- denominator : TBasicType TInt
    IO ()

{- |
Sets /@value@/ to the fraction specified by /@numerator@/ over /@denominator@/.
The fraction gets reduced to the smallest numerator and denominator,
and if necessary the sign is moved to the numerator.
-}
valueSetFraction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to @/GST_TYPE_FRACTION/@ -}
    -> Int32
    {- ^ /@numerator@/: the numerator of the fraction -}
    -> Int32
    {- ^ /@denominator@/: the denominator of the fraction -}
    -> m ()
valueSetFraction value numerator denominator = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    gst_value_set_fraction value' numerator denominator
    touchManagedPtr value
    return ()


-- function gst_value_set_flagset
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to %GST_TYPE_FLAG_SET", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The value of the flags set or unset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mask", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The mask indicate which flags bits must match for comparisons", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_flagset" gst_value_set_flagset ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Word32 ->                               -- flags : TBasicType TUInt
    Word32 ->                               -- mask : TBasicType TUInt
    IO ()

{- |
Sets /@value@/ to the flags and mask values provided in /@flags@/ and /@mask@/.
The /@flags@/ value indicates the values of flags, the /@mask@/ represents
which bits in the flag value have been set, and which are \"don\'t care\"

/Since: 1.6/
-}
valueSetFlagset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to @/GST_TYPE_FLAG_SET/@ -}
    -> Word32
    {- ^ /@flags@/: The value of the flags set or unset -}
    -> Word32
    {- ^ /@mask@/: The mask indicate which flags bits must match for comparisons -}
    -> m ()
valueSetFlagset value flags mask = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    gst_value_set_flagset value' flags mask
    touchManagedPtr value
    return ()


-- function gst_value_set_double_range
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_DOUBLE_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the end of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_double_range" gst_value_set_double_range ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    CDouble ->                              -- start : TBasicType TDouble
    CDouble ->                              -- end : TBasicType TDouble
    IO ()

{- |
Sets /@value@/ to the range specified by /@start@/ and /@end@/.
-}
valueSetDoubleRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_DOUBLE_RANGE -}
    -> Double
    {- ^ /@start@/: the start of the range -}
    -> Double
    {- ^ /@end@/: the end of the range -}
    -> m ()
valueSetDoubleRange value start end = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    let start' = realToFrac start
    let end' = realToFrac end
    gst_value_set_double_range value' start' end'
    touchManagedPtr value
    return ()


-- function gst_value_set_caps_features
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_CAPS_FEATURES", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "features", argType = TInterface (Name {namespace = "Gst", name = "CapsFeatures"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the features to set the value to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_caps_features" gst_value_set_caps_features ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr Gst.CapsFeatures.CapsFeatures ->    -- features : TInterface (Name {namespace = "Gst", name = "CapsFeatures"})
    IO ()

{- |
Sets the contents of /@value@/ to /@features@/.
-}
valueSetCapsFeatures ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_CAPS_FEATURES -}
    -> Gst.CapsFeatures.CapsFeatures
    {- ^ /@features@/: the features to set the value to -}
    -> m ()
valueSetCapsFeatures value features = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    features' <- unsafeManagedPtrGetPtr features
    gst_value_set_caps_features value' features'
    touchManagedPtr value
    touchManagedPtr features
    return ()


-- function gst_value_set_caps
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_CAPS", 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 caps to set the value to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_caps" gst_value_set_caps ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO ()

{- |
Sets the contents of /@value@/ to /@caps@/. A reference to the
provided /@caps@/ will be taken by the /@value@/.
-}
valueSetCaps ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_CAPS -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: the caps to set the value to -}
    -> m ()
valueSetCaps value caps = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    caps' <- unsafeManagedPtrGetPtr caps
    gst_value_set_caps value' caps'
    touchManagedPtr value
    touchManagedPtr caps
    return ()


-- function gst_value_set_bitmask
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_BITMASK", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "bitmask", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the bitmask", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_set_bitmask" gst_value_set_bitmask ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    Word64 ->                               -- bitmask : TBasicType TUInt64
    IO ()

{- |
Sets /@value@/ to the bitmask specified by /@bitmask@/.
-}
valueSetBitmask ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to @/GST_TYPE_BITMASK/@ -}
    -> Word64
    {- ^ /@bitmask@/: the bitmask -}
    -> m ()
valueSetBitmask value bitmask = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    gst_value_set_bitmask value' bitmask
    touchManagedPtr value
    return ()


-- function gst_value_serialize
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValue to serialize", 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_value_serialize" gst_value_serialize ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CString

{- |
tries to transform the given /@value@/ into a string representation that allows
getting back this string later on using 'GI.Gst.Functions.valueDeserialize'.

Free-function: g_free
-}
valueSerialize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a 'GI.GObject.Structs.Value.Value' to serialize -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the serialization for /@value@/
or 'Nothing' if none exists -}
valueSerialize value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_serialize value'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    touchManagedPtr value
    return maybeResult


-- function gst_value_register
-- Args : [Arg {argCName = "table", argType = TInterface (Name {namespace = "Gst", name = "ValueTable"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "structure containing functions to register", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_register" gst_value_register ::
    Ptr Gst.ValueTable.ValueTable ->        -- table : TInterface (Name {namespace = "Gst", name = "ValueTable"})
    IO ()

{- |
Registers functions to perform calculations on 'GI.GObject.Structs.Value.Value' items of a given
type. Each type can only be added once.
-}
valueRegister ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.ValueTable.ValueTable
    {- ^ /@table@/: structure containing functions to register -}
    -> m ()
valueRegister table = liftIO $ do
    table' <- unsafeManagedPtrGetPtr table
    gst_value_register table'
    touchManagedPtr table
    return ()


-- function gst_value_is_subset
-- Args : [Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValue", 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_value_is_subset" gst_value_is_subset ::
    Ptr GValue ->                           -- value1 : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- value2 : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Check that /@value1@/ is a subset of /@value2@/.
-}
valueIsSubset ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value1@/: a 'GI.GObject.Structs.Value.Value' -}
    -> GValue
    {- ^ /@value2@/: a 'GI.GObject.Structs.Value.Value' -}
    -> m Bool
    {- ^ __Returns:__ 'True' is /@value1@/ is a subset of /@value2@/ -}
valueIsSubset value1 value2 = liftIO $ do
    value1' <- unsafeManagedPtrGetPtr value1
    value2' <- unsafeManagedPtrGetPtr value2
    result <- gst_value_is_subset value1' value2'
    let result' = (/= 0) result
    touchManagedPtr value1
    touchManagedPtr value2
    return result'


-- function gst_value_is_fixed
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GValue to check", 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_value_is_fixed" gst_value_is_fixed ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Tests if the given GValue, if available in a GstStructure (or any other
container) contains a \"fixed\" (which means: one value) or an \"unfixed\"
(which means: multiple possible values, such as data lists or data
ranges) value.
-}
valueIsFixed ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: the 'GI.GObject.Structs.Value.Value' to check -}
    -> m Bool
    {- ^ __Returns:__ true if the value is \"fixed\". -}
valueIsFixed value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_is_fixed value'
    let result' = (/= 0) result
    touchManagedPtr value
    return result'


-- function gst_value_intersect
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "\n  a uninitialized #GValue that will hold the calculated\n  intersection value. May be %NULL if the resulting set if not\n  needed.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferEverything},Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value to intersect", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "another value to intersect", 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_value_intersect" gst_value_intersect ::
    Ptr GValue ->                           -- dest : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- value1 : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- value2 : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Calculates the intersection of two values.  If the values have
a non-empty intersection, the value representing the intersection
is placed in /@dest@/, unless 'Nothing'.  If the intersection is non-empty,
/@dest@/ is not modified.
-}
valueIntersect ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value1@/: a value to intersect -}
    -> GValue
    {- ^ /@value2@/: another value to intersect -}
    -> m ((Bool, GValue))
    {- ^ __Returns:__ 'True' if the intersection is non-empty -}
valueIntersect value1 value2 = liftIO $ do
    dest <- callocBoxedBytes 24 :: IO (Ptr GValue)
    value1' <- unsafeManagedPtrGetPtr value1
    value2' <- unsafeManagedPtrGetPtr value2
    result <- gst_value_intersect dest value1' value2'
    let result' = (/= 0) result
    dest' <- (wrapBoxed GValue) dest
    touchManagedPtr value1
    touchManagedPtr value2
    return (result', dest')


-- function gst_value_init_and_copy
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the target value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "src", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_init_and_copy" gst_value_init_and_copy ::
    Ptr GValue ->                           -- dest : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- src : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
Initialises the target value to be of the same type as source and then copies
the contents from source to target.
-}
valueInitAndCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@src@/: the source value -}
    -> m (GValue)
valueInitAndCopy src = liftIO $ do
    dest <- callocBoxedBytes 24 :: IO (Ptr GValue)
    src' <- unsafeManagedPtrGetPtr src
    gst_value_init_and_copy dest src'
    dest' <- (wrapBoxed GValue) dest
    touchManagedPtr src
    return dest'


-- function gst_value_get_structure
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_STRUCTURE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Structure"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_structure" gst_value_get_structure ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO (Ptr Gst.Structure.Structure)

{- |
Gets the contents of /@value@/.
-}
valueGetStructure ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_STRUCTURE -}
    -> m Gst.Structure.Structure
    {- ^ __Returns:__ the contents of /@value@/ -}
valueGetStructure value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_structure value'
    checkUnexpectedReturnNULL "valueGetStructure" result
    result' <- (newBoxed Gst.Structure.Structure) result
    touchManagedPtr value
    return result'


-- function gst_value_get_int_range_step
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT_RANGE", 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_value_get_int_range_step" gst_value_get_int_range_step ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Int32

{- |
Gets the step of the range specified by /@value@/.
-}
valueGetIntRangeStep ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT_RANGE -}
    -> m Int32
    {- ^ __Returns:__ the step of the range -}
valueGetIntRangeStep value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_int_range_step value'
    touchManagedPtr value
    return result


-- function gst_value_get_int_range_min
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT_RANGE", 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_value_get_int_range_min" gst_value_get_int_range_min ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Int32

{- |
Gets the minimum of the range specified by /@value@/.
-}
valueGetIntRangeMin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT_RANGE -}
    -> m Int32
    {- ^ __Returns:__ the minimum of the range -}
valueGetIntRangeMin value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_int_range_min value'
    touchManagedPtr value
    return result


-- function gst_value_get_int_range_max
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT_RANGE", 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_value_get_int_range_max" gst_value_get_int_range_max ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Int32

{- |
Gets the maximum of the range specified by /@value@/.
-}
valueGetIntRangeMax ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT_RANGE -}
    -> m Int32
    {- ^ __Returns:__ the maximum of the range -}
valueGetIntRangeMax value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_int_range_max value'
    touchManagedPtr value
    return result


-- function gst_value_get_int64_range_step
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT64_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_int64_range_step" gst_value_get_int64_range_step ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Int64

{- |
Gets the step of the range specified by /@value@/.
-}
valueGetInt64RangeStep ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT64_RANGE -}
    -> m Int64
    {- ^ __Returns:__ the step of the range -}
valueGetInt64RangeStep value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_int64_range_step value'
    touchManagedPtr value
    return result


-- function gst_value_get_int64_range_min
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT64_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_int64_range_min" gst_value_get_int64_range_min ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Int64

{- |
Gets the minimum of the range specified by /@value@/.
-}
valueGetInt64RangeMin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT64_RANGE -}
    -> m Int64
    {- ^ __Returns:__ the minimum of the range -}
valueGetInt64RangeMin value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_int64_range_min value'
    touchManagedPtr value
    return result


-- function gst_value_get_int64_range_max
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_INT64_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_int64_range_max" gst_value_get_int64_range_max ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Int64

{- |
Gets the maximum of the range specified by /@value@/.
-}
valueGetInt64RangeMax ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_INT64_RANGE -}
    -> m Int64
    {- ^ __Returns:__ the maximum of the range -}
valueGetInt64RangeMax value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_int64_range_max value'
    touchManagedPtr value
    return result


-- function gst_value_get_fraction_range_min
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_FRACTION_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GObject", name = "Value"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_fraction_range_min" gst_value_get_fraction_range_min ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO (Ptr GValue)

{- |
Gets the minimum of the range specified by /@value@/.
-}
valueGetFractionRangeMin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_FRACTION_RANGE -}
    -> m (Maybe GValue)
    {- ^ __Returns:__ the minimum of the range -}
valueGetFractionRangeMin value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_fraction_range_min value'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed GValue) result'
        return result''
    touchManagedPtr value
    return maybeResult


-- function gst_value_get_fraction_range_max
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_FRACTION_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GObject", name = "Value"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_fraction_range_max" gst_value_get_fraction_range_max ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO (Ptr GValue)

{- |
Gets the maximum of the range specified by /@value@/.
-}
valueGetFractionRangeMax ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_FRACTION_RANGE -}
    -> m (Maybe GValue)
    {- ^ __Returns:__ the maximum of the range -}
valueGetFractionRangeMax value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_fraction_range_max value'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed GValue) result'
        return result''
    touchManagedPtr value
    return maybeResult


-- function gst_value_get_fraction_numerator
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FRACTION", 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_value_get_fraction_numerator" gst_value_get_fraction_numerator ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Int32

{- |
Gets the numerator of the fraction specified by /@value@/.
-}
valueGetFractionNumerator ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to @/GST_TYPE_FRACTION/@ -}
    -> m Int32
    {- ^ __Returns:__ the numerator of the fraction. -}
valueGetFractionNumerator value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_fraction_numerator value'
    touchManagedPtr value
    return result


-- function gst_value_get_fraction_denominator
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FRACTION", 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_value_get_fraction_denominator" gst_value_get_fraction_denominator ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Int32

{- |
Gets the denominator of the fraction specified by /@value@/.
-}
valueGetFractionDenominator ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to @/GST_TYPE_FRACTION/@ -}
    -> m Int32
    {- ^ __Returns:__ the denominator of the fraction. -}
valueGetFractionDenominator value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_fraction_denominator value'
    touchManagedPtr value
    return result


-- function gst_value_get_flagset_mask
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FLAG_SET", 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_value_get_flagset_mask" gst_value_get_flagset_mask ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Word32

{- |
Retrieve the mask field of a GstFlagSet /@value@/.

/Since: 1.6/
-}
valueGetFlagsetMask ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to @/GST_TYPE_FLAG_SET/@ -}
    -> m Word32
    {- ^ __Returns:__ the mask field of the flagset instance. -}
valueGetFlagsetMask value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_flagset_mask value'
    touchManagedPtr value
    return result


-- function gst_value_get_flagset_flags
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FLAG_SET", 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_value_get_flagset_flags" gst_value_get_flagset_flags ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Word32

{- |
Retrieve the flags field of a GstFlagSet /@value@/.

/Since: 1.6/
-}
valueGetFlagsetFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to @/GST_TYPE_FLAG_SET/@ -}
    -> m Word32
    {- ^ __Returns:__ the flags field of the flagset instance. -}
valueGetFlagsetFlags value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_flagset_flags value'
    touchManagedPtr value
    return result


-- function gst_value_get_double_range_min
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_DOUBLE_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_double_range_min" gst_value_get_double_range_min ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CDouble

{- |
Gets the minimum of the range specified by /@value@/.
-}
valueGetDoubleRangeMin ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_DOUBLE_RANGE -}
    -> m Double
    {- ^ __Returns:__ the minimum of the range -}
valueGetDoubleRangeMin value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_double_range_min value'
    let result' = realToFrac result
    touchManagedPtr value
    return result'


-- function gst_value_get_double_range_max
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_DOUBLE_RANGE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_double_range_max" gst_value_get_double_range_max ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CDouble

{- |
Gets the maximum of the range specified by /@value@/.
-}
valueGetDoubleRangeMax ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_DOUBLE_RANGE -}
    -> m Double
    {- ^ __Returns:__ the maximum of the range -}
valueGetDoubleRangeMax value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_double_range_max value'
    let result' = realToFrac result
    touchManagedPtr value
    return result'


-- function gst_value_get_caps_features
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_CAPS_FEATURES", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "CapsFeatures"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_caps_features" gst_value_get_caps_features ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO (Ptr Gst.CapsFeatures.CapsFeatures)

{- |
Gets the contents of /@value@/.
-}
valueGetCapsFeatures ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_CAPS_FEATURES -}
    -> m Gst.CapsFeatures.CapsFeatures
    {- ^ __Returns:__ the contents of /@value@/ -}
valueGetCapsFeatures value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_caps_features value'
    checkUnexpectedReturnNULL "valueGetCapsFeatures" result
    result' <- (newBoxed Gst.CapsFeatures.CapsFeatures) result
    touchManagedPtr value
    return result'


-- function gst_value_get_caps
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to GST_TYPE_CAPS", 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_value_get_caps" gst_value_get_caps ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO (Ptr Gst.Caps.Caps)

{- |
Gets the contents of /@value@/. The reference count of the returned
'GI.Gst.Structs.Caps.Caps' will not be modified, therefore the caller must take one
before getting rid of the /@value@/.
-}
valueGetCaps ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to GST_TYPE_CAPS -}
    -> m Gst.Caps.Caps
    {- ^ __Returns:__ the contents of /@value@/ -}
valueGetCaps value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_caps value'
    checkUnexpectedReturnNULL "valueGetCaps" result
    result' <- (newBoxed Gst.Caps.Caps) result
    touchManagedPtr value
    return result'


-- function gst_value_get_bitmask
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_BITMASK", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_value_get_bitmask" gst_value_get_bitmask ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Word64

{- |
Gets the bitmask specified by /@value@/.
-}
valueGetBitmask ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value@/: a GValue initialized to @/GST_TYPE_BITMASK/@ -}
    -> m Word64
    {- ^ __Returns:__ the bitmask. -}
valueGetBitmask value = liftIO $ do
    value' <- unsafeManagedPtrGetPtr value
    result <- gst_value_get_bitmask value'
    touchManagedPtr value
    return result


-- function gst_value_fraction_subtract
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FRACTION", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minuend", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FRACTION", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "subtrahend", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FRACTION", 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_value_fraction_subtract" gst_value_fraction_subtract ::
    Ptr GValue ->                           -- dest : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- minuend : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- subtrahend : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Subtracts the /@subtrahend@/ from the /@minuend@/ and sets /@dest@/ to the result.
-}
valueFractionSubtract ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@dest@/: a GValue initialized to @/GST_TYPE_FRACTION/@ -}
    -> GValue
    {- ^ /@minuend@/: a GValue initialized to @/GST_TYPE_FRACTION/@ -}
    -> GValue
    {- ^ /@subtrahend@/: a GValue initialized to @/GST_TYPE_FRACTION/@ -}
    -> m Bool
    {- ^ __Returns:__ 'False' in case of an error (like integer overflow), 'True' otherwise. -}
valueFractionSubtract dest minuend subtrahend = liftIO $ do
    dest' <- unsafeManagedPtrGetPtr dest
    minuend' <- unsafeManagedPtrGetPtr minuend
    subtrahend' <- unsafeManagedPtrGetPtr subtrahend
    result <- gst_value_fraction_subtract dest' minuend' subtrahend'
    let result' = (/= 0) result
    touchManagedPtr dest
    touchManagedPtr minuend
    touchManagedPtr subtrahend
    return result'


-- function gst_value_fraction_multiply
-- Args : [Arg {argCName = "product", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FRACTION", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "factor1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FRACTION", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "factor2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GValue initialized to #GST_TYPE_FRACTION", 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_value_fraction_multiply" gst_value_fraction_multiply ::
    Ptr GValue ->                           -- product : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- factor1 : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- factor2 : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Multiplies the two 'GI.GObject.Structs.Value.Value' items containing a @/GST_TYPE_FRACTION/@ and sets
/@product@/ to the product of the two fractions.
-}
valueFractionMultiply ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@product@/: a GValue initialized to @/GST_TYPE_FRACTION/@ -}
    -> GValue
    {- ^ /@factor1@/: a GValue initialized to @/GST_TYPE_FRACTION/@ -}
    -> GValue
    {- ^ /@factor2@/: a GValue initialized to @/GST_TYPE_FRACTION/@ -}
    -> m Bool
    {- ^ __Returns:__ 'False' in case of an error (like integer overflow), 'True' otherwise. -}
valueFractionMultiply product factor1 factor2 = liftIO $ do
    product' <- unsafeManagedPtrGetPtr product
    factor1' <- unsafeManagedPtrGetPtr factor1
    factor2' <- unsafeManagedPtrGetPtr factor2
    result <- gst_value_fraction_multiply product' factor1' factor2'
    let result' = (/= 0) result
    touchManagedPtr product
    touchManagedPtr factor1
    touchManagedPtr factor2
    return result'


-- function gst_value_fixate
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GValue destination", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GValue to fixate", 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_value_fixate" gst_value_fixate ::
    Ptr GValue ->                           -- dest : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- src : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Fixate /@src@/ into a new value /@dest@/.
For ranges, the first element is taken. For lists and arrays, the
first item is fixated and returned.
If /@src@/ is already fixed, this function returns 'False'.
-}
valueFixate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@dest@/: the 'GI.GObject.Structs.Value.Value' destination -}
    -> GValue
    {- ^ /@src@/: the 'GI.GObject.Structs.Value.Value' to fixate -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@dest@/ contains a fixated version of /@src@/. -}
valueFixate dest src = liftIO $ do
    dest' <- unsafeManagedPtrGetPtr dest
    src' <- unsafeManagedPtrGetPtr src
    result <- gst_value_fixate dest' src'
    let result' = (/= 0) result
    touchManagedPtr dest
    touchManagedPtr src
    return result'


-- function gst_value_deserialize
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GValue to fill with contents of\n    deserialization", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "src", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "string to deserialize", 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_value_deserialize" gst_value_deserialize ::
    Ptr GValue ->                           -- dest : TInterface (Name {namespace = "GObject", name = "Value"})
    CString ->                              -- src : TBasicType TUTF8
    IO CInt

{- |
Tries to deserialize a string into the type specified by the given GValue.
If the operation succeeds, 'True' is returned, 'False' otherwise.
-}
valueDeserialize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@src@/: string to deserialize -}
    -> m ((Bool, GValue))
    {- ^ __Returns:__ 'True' on success -}
valueDeserialize src = liftIO $ do
    dest <- callocBoxedBytes 24 :: IO (Ptr GValue)
    src' <- textToCString src
    result <- gst_value_deserialize dest src'
    let result' = (/= 0) result
    dest' <- (wrapBoxed GValue) dest
    freeMem src'
    return (result', dest')


-- function gst_value_compare
-- Args : [Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value to compare", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "another value to compare", 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_value_compare" gst_value_compare ::
    Ptr GValue ->                           -- value1 : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- value2 : TInterface (Name {namespace = "GObject", name = "Value"})
    IO Int32

{- |
Compares /@value1@/ and /@value2@/.  If /@value1@/ and /@value2@/ cannot be
compared, the function returns GST_VALUE_UNORDERED.  Otherwise,
if /@value1@/ is greater than /@value2@/, GST_VALUE_GREATER_THAN is returned.
If /@value1@/ is less than /@value2@/, GST_VALUE_LESS_THAN is returned.
If the values are equal, GST_VALUE_EQUAL is returned.
-}
valueCompare ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value1@/: a value to compare -}
    -> GValue
    {- ^ /@value2@/: another value to compare -}
    -> m Int32
    {- ^ __Returns:__ comparison result -}
valueCompare value1 value2 = liftIO $ do
    value1' <- unsafeManagedPtrGetPtr value1
    value2' <- unsafeManagedPtrGetPtr value2
    result <- gst_value_compare value1' value2'
    touchManagedPtr value1
    touchManagedPtr value2
    return result


-- function gst_value_can_union
-- Args : [Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value to union", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "another value to union", 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_value_can_union" gst_value_can_union ::
    Ptr GValue ->                           -- value1 : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- value2 : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Determines if /@value1@/ and /@value2@/ can be non-trivially unioned.
Any two values can be trivially unioned by adding both of them
to a GstValueList.  However, certain types have the possibility
to be unioned in a simpler way.  For example, an integer range
and an integer can be unioned if the integer is a subset of the
integer range.  If there is the possibility that two values can
be unioned, this function returns 'True'.
-}
valueCanUnion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value1@/: a value to union -}
    -> GValue
    {- ^ /@value2@/: another value to union -}
    -> m Bool
    {- ^ __Returns:__ 'True' if there is a function allowing the two values to
be unioned. -}
valueCanUnion value1 value2 = liftIO $ do
    value1' <- unsafeManagedPtrGetPtr value1
    value2' <- unsafeManagedPtrGetPtr value2
    result <- gst_value_can_union value1' value2'
    let result' = (/= 0) result
    touchManagedPtr value1
    touchManagedPtr value2
    return result'


-- function gst_value_can_subtract
-- Args : [Arg {argCName = "minuend", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value to subtract from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "subtrahend", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value to subtract", 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_value_can_subtract" gst_value_can_subtract ::
    Ptr GValue ->                           -- minuend : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- subtrahend : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Checks if it\'s possible to subtract /@subtrahend@/ from /@minuend@/.
-}
valueCanSubtract ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@minuend@/: the value to subtract from -}
    -> GValue
    {- ^ /@subtrahend@/: the value to subtract -}
    -> m Bool
    {- ^ __Returns:__ 'True' if a subtraction is possible -}
valueCanSubtract minuend subtrahend = liftIO $ do
    minuend' <- unsafeManagedPtrGetPtr minuend
    subtrahend' <- unsafeManagedPtrGetPtr subtrahend
    result <- gst_value_can_subtract minuend' subtrahend'
    let result' = (/= 0) result
    touchManagedPtr minuend
    touchManagedPtr subtrahend
    return result'


-- function gst_value_can_intersect
-- Args : [Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value to intersect", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "another value to intersect", 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_value_can_intersect" gst_value_can_intersect ::
    Ptr GValue ->                           -- value1 : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- value2 : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Determines if intersecting two values will produce a valid result.
Two values will produce a valid intersection if they have the same
type.
-}
valueCanIntersect ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value1@/: a value to intersect -}
    -> GValue
    {- ^ /@value2@/: another value to intersect -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the values can intersect -}
valueCanIntersect value1 value2 = liftIO $ do
    value1' <- unsafeManagedPtrGetPtr value1
    value2' <- unsafeManagedPtrGetPtr value2
    result <- gst_value_can_intersect value1' value2'
    let result' = (/= 0) result
    touchManagedPtr value1
    touchManagedPtr value2
    return result'


-- function gst_value_can_compare
-- Args : [Arg {argCName = "value1", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a value to compare", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value2", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "another value to compare", 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_value_can_compare" gst_value_can_compare ::
    Ptr GValue ->                           -- value1 : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- value2 : TInterface (Name {namespace = "GObject", name = "Value"})
    IO CInt

{- |
Determines if /@value1@/ and /@value2@/ can be compared.
-}
valueCanCompare ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@value1@/: a value to compare -}
    -> GValue
    {- ^ /@value2@/: another value to compare -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the values can be compared -}
valueCanCompare value1 value2 = liftIO $ do
    value1' <- unsafeManagedPtrGetPtr value1
    value2' <- unsafeManagedPtrGetPtr value2
    result <- gst_value_can_compare value1' value2'
    let result' = (/= 0) result
    touchManagedPtr value1
    touchManagedPtr value2
    return result'


-- function gst_util_uint64_scale_round
-- Args : [Arg {argCName = "val", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number to scale", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "num", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the numerator of the scale ratio", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "denom", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the denominator of the scale ratio", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_uint64_scale_round" gst_util_uint64_scale_round ::
    Word64 ->                               -- val : TBasicType TUInt64
    Word64 ->                               -- num : TBasicType TUInt64
    Word64 ->                               -- denom : TBasicType TUInt64
    IO Word64

{- |
Scale /@val@/ by the rational number /@num@/ \/ /@denom@/, avoiding overflows and
underflows and without loss of precision.

This function can potentially be very slow if val and num are both
greater than G_MAXUINT32.
-}
utilUint64ScaleRound ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@val@/: the number to scale -}
    -> Word64
    {- ^ /@num@/: the numerator of the scale ratio -}
    -> Word64
    {- ^ /@denom@/: the denominator of the scale ratio -}
    -> m Word64
    {- ^ __Returns:__ /@val@/ * /@num@/ \/ /@denom@/.  In the case of an overflow, this
function returns G_MAXUINT64.  If the result is not exactly
representable as an integer, it is rounded to the nearest integer
(half-way cases are rounded up).  See also 'GI.Gst.Functions.utilUint64Scale',
'GI.Gst.Functions.utilUint64ScaleCeil', 'GI.Gst.Functions.utilUint64ScaleInt',
'GI.Gst.Functions.utilUint64ScaleIntRound', 'GI.Gst.Functions.utilUint64ScaleIntCeil'. -}
utilUint64ScaleRound val num denom = liftIO $ do
    result <- gst_util_uint64_scale_round val num denom
    return result


-- function gst_util_uint64_scale_int_round
-- Args : [Arg {argCName = "val", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "guint64 (such as a #GstClockTime) to scale.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "num", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "numerator of the scale factor.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "denom", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "denominator of the scale factor.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_uint64_scale_int_round" gst_util_uint64_scale_int_round ::
    Word64 ->                               -- val : TBasicType TUInt64
    Int32 ->                                -- num : TBasicType TInt
    Int32 ->                                -- denom : TBasicType TInt
    IO Word64

{- |
Scale /@val@/ by the rational number /@num@/ \/ /@denom@/, avoiding overflows and
underflows and without loss of precision.  /@num@/ must be non-negative and
/@denom@/ must be positive.
-}
utilUint64ScaleIntRound ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@val@/: guint64 (such as a @/GstClockTime/@) to scale. -}
    -> Int32
    {- ^ /@num@/: numerator of the scale factor. -}
    -> Int32
    {- ^ /@denom@/: denominator of the scale factor. -}
    -> m Word64
    {- ^ __Returns:__ /@val@/ * /@num@/ \/ /@denom@/.  In the case of an overflow, this
function returns G_MAXUINT64.  If the result is not exactly
representable as an integer, it is rounded to the nearest integer
(half-way cases are rounded up).  See also 'GI.Gst.Functions.utilUint64ScaleInt',
'GI.Gst.Functions.utilUint64ScaleIntCeil', 'GI.Gst.Functions.utilUint64Scale',
'GI.Gst.Functions.utilUint64ScaleRound', 'GI.Gst.Functions.utilUint64ScaleCeil'. -}
utilUint64ScaleIntRound val num denom = liftIO $ do
    result <- gst_util_uint64_scale_int_round val num denom
    return result


-- function gst_util_uint64_scale_int_ceil
-- Args : [Arg {argCName = "val", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "guint64 (such as a #GstClockTime) to scale.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "num", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "numerator of the scale factor.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "denom", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "denominator of the scale factor.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_uint64_scale_int_ceil" gst_util_uint64_scale_int_ceil ::
    Word64 ->                               -- val : TBasicType TUInt64
    Int32 ->                                -- num : TBasicType TInt
    Int32 ->                                -- denom : TBasicType TInt
    IO Word64

{- |
Scale /@val@/ by the rational number /@num@/ \/ /@denom@/, avoiding overflows and
underflows and without loss of precision.  /@num@/ must be non-negative and
/@denom@/ must be positive.
-}
utilUint64ScaleIntCeil ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@val@/: guint64 (such as a @/GstClockTime/@) to scale. -}
    -> Int32
    {- ^ /@num@/: numerator of the scale factor. -}
    -> Int32
    {- ^ /@denom@/: denominator of the scale factor. -}
    -> m Word64
    {- ^ __Returns:__ /@val@/ * /@num@/ \/ /@denom@/.  In the case of an overflow, this
function returns G_MAXUINT64.  If the result is not exactly
representable as an integer, it is rounded up.  See also
'GI.Gst.Functions.utilUint64ScaleInt', 'GI.Gst.Functions.utilUint64ScaleIntRound',
'GI.Gst.Functions.utilUint64Scale', 'GI.Gst.Functions.utilUint64ScaleRound',
'GI.Gst.Functions.utilUint64ScaleCeil'. -}
utilUint64ScaleIntCeil val num denom = liftIO $ do
    result <- gst_util_uint64_scale_int_ceil val num denom
    return result


-- function gst_util_uint64_scale_int
-- Args : [Arg {argCName = "val", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "guint64 (such as a #GstClockTime) to scale.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "num", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "numerator of the scale factor.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "denom", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "denominator of the scale factor.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_uint64_scale_int" gst_util_uint64_scale_int ::
    Word64 ->                               -- val : TBasicType TUInt64
    Int32 ->                                -- num : TBasicType TInt
    Int32 ->                                -- denom : TBasicType TInt
    IO Word64

{- |
Scale /@val@/ by the rational number /@num@/ \/ /@denom@/, avoiding overflows and
underflows and without loss of precision.  /@num@/ must be non-negative and
/@denom@/ must be positive.
-}
utilUint64ScaleInt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@val@/: guint64 (such as a @/GstClockTime/@) to scale. -}
    -> Int32
    {- ^ /@num@/: numerator of the scale factor. -}
    -> Int32
    {- ^ /@denom@/: denominator of the scale factor. -}
    -> m Word64
    {- ^ __Returns:__ /@val@/ * /@num@/ \/ /@denom@/.  In the case of an overflow, this
function returns G_MAXUINT64.  If the result is not exactly
representable as an integer, it is truncated.  See also
'GI.Gst.Functions.utilUint64ScaleIntRound', 'GI.Gst.Functions.utilUint64ScaleIntCeil',
'GI.Gst.Functions.utilUint64Scale', 'GI.Gst.Functions.utilUint64ScaleRound',
'GI.Gst.Functions.utilUint64ScaleCeil'. -}
utilUint64ScaleInt val num denom = liftIO $ do
    result <- gst_util_uint64_scale_int val num denom
    return result


-- function gst_util_uint64_scale_ceil
-- Args : [Arg {argCName = "val", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number to scale", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "num", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the numerator of the scale ratio", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "denom", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the denominator of the scale ratio", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_uint64_scale_ceil" gst_util_uint64_scale_ceil ::
    Word64 ->                               -- val : TBasicType TUInt64
    Word64 ->                               -- num : TBasicType TUInt64
    Word64 ->                               -- denom : TBasicType TUInt64
    IO Word64

{- |
Scale /@val@/ by the rational number /@num@/ \/ /@denom@/, avoiding overflows and
underflows and without loss of precision.

This function can potentially be very slow if val and num are both
greater than G_MAXUINT32.
-}
utilUint64ScaleCeil ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@val@/: the number to scale -}
    -> Word64
    {- ^ /@num@/: the numerator of the scale ratio -}
    -> Word64
    {- ^ /@denom@/: the denominator of the scale ratio -}
    -> m Word64
    {- ^ __Returns:__ /@val@/ * /@num@/ \/ /@denom@/.  In the case of an overflow, this
function returns G_MAXUINT64.  If the result is not exactly
representable as an integer, it is rounded up.  See also
'GI.Gst.Functions.utilUint64Scale', 'GI.Gst.Functions.utilUint64ScaleRound',
'GI.Gst.Functions.utilUint64ScaleInt', 'GI.Gst.Functions.utilUint64ScaleIntRound',
'GI.Gst.Functions.utilUint64ScaleIntCeil'. -}
utilUint64ScaleCeil val num denom = liftIO $ do
    result <- gst_util_uint64_scale_ceil val num denom
    return result


-- function gst_util_uint64_scale
-- Args : [Arg {argCName = "val", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number to scale", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "num", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the numerator of the scale ratio", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "denom", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the denominator of the scale ratio", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_uint64_scale" gst_util_uint64_scale ::
    Word64 ->                               -- val : TBasicType TUInt64
    Word64 ->                               -- num : TBasicType TUInt64
    Word64 ->                               -- denom : TBasicType TUInt64
    IO Word64

{- |
Scale /@val@/ by the rational number /@num@/ \/ /@denom@/, avoiding overflows and
underflows and without loss of precision.

This function can potentially be very slow if val and num are both
greater than G_MAXUINT32.
-}
utilUint64Scale ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    {- ^ /@val@/: the number to scale -}
    -> Word64
    {- ^ /@num@/: the numerator of the scale ratio -}
    -> Word64
    {- ^ /@denom@/: the denominator of the scale ratio -}
    -> m Word64
    {- ^ __Returns:__ /@val@/ * /@num@/ \/ /@denom@/.  In the case of an overflow, this
function returns G_MAXUINT64.  If the result is not exactly
representable as an integer it is truncated.  See also
'GI.Gst.Functions.utilUint64ScaleRound', 'GI.Gst.Functions.utilUint64ScaleCeil',
'GI.Gst.Functions.utilUint64ScaleInt', 'GI.Gst.Functions.utilUint64ScaleIntRound',
'GI.Gst.Functions.utilUint64ScaleIntCeil'. -}
utilUint64Scale val num denom = liftIO $ do
    result <- gst_util_uint64_scale val num denom
    return result


-- function gst_util_set_value_from_string
-- Args : [Arg {argCName = "value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "value_str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to get the value from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_set_value_from_string" gst_util_set_value_from_string ::
    Ptr GValue ->                           -- value : TInterface (Name {namespace = "GObject", name = "Value"})
    CString ->                              -- value_str : TBasicType TUTF8
    IO ()

{- |
Converts the string to the type of the value and
sets the value with it.

Note that this function is dangerous as it does not return any indication
if the conversion worked or not.
-}
utilSetValueFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@valueStr@/: the string to get the value from -}
    -> m (GValue)
utilSetValueFromString valueStr = liftIO $ do
    value <- callocBoxedBytes 24 :: IO (Ptr GValue)
    valueStr' <- textToCString valueStr
    gst_util_set_value_from_string value valueStr'
    value' <- (wrapBoxed GValue) value
    freeMem valueStr'
    return value'


-- function gst_util_set_object_array
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object to set the array to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the property to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "array", argType = TInterface (Name {namespace = "GObject", name = "ValueArray"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GValueArray containing the values", 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_util_set_object_array" gst_util_set_object_array ::
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    CString ->                              -- name : TBasicType TUTF8
    Ptr GObject.ValueArray.ValueArray ->    -- array : TInterface (Name {namespace = "GObject", name = "ValueArray"})
    IO CInt

{- |
Transfer a 'GI.GObject.Structs.ValueArray.ValueArray' to @/GST_TYPE_ARRAY/@ and set this value on the
specified property name. This allow language bindings to set GST_TYPE_ARRAY
properties which are otherwise not an accessible type.

/Since: 1.12/
-}
utilSetObjectArray ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    a
    {- ^ /@object@/: the object to set the array to -}
    -> T.Text
    {- ^ /@name@/: the name of the property to set -}
    -> GObject.ValueArray.ValueArray
    {- ^ /@array@/: a 'GI.GObject.Structs.ValueArray.ValueArray' containing the values -}
    -> m Bool
utilSetObjectArray object name array = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    name' <- textToCString name
    array' <- unsafeManagedPtrGetPtr array
    result <- gst_util_set_object_array object' name' array'
    let result' = (/= 0) result
    touchManagedPtr object
    touchManagedPtr array
    freeMem name'
    return result'


-- function gst_util_set_object_arg
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object to set the argument of", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the argument to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string value to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_set_object_arg" gst_util_set_object_arg ::
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- value : TBasicType TUTF8
    IO ()

{- |
Converts the string value to the type of the objects argument and
sets the argument with it.

Note that this function silently returns if /@object@/ has no property named
/@name@/ or when /@value@/ cannot be converted to the type of the property.
-}
utilSetObjectArg ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    a
    {- ^ /@object@/: the object to set the argument of -}
    -> T.Text
    {- ^ /@name@/: the name of the argument to set -}
    -> T.Text
    {- ^ /@value@/: the string value to set -}
    -> m ()
utilSetObjectArg object name value = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    name' <- textToCString name
    value' <- textToCString value
    gst_util_set_object_arg object' name' value'
    touchManagedPtr object
    freeMem name'
    freeMem value'
    return ()


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

foreign import ccall "gst_util_seqnum_next" gst_util_seqnum_next ::
    IO Word32

{- |
Return a constantly incrementing sequence number.

This function is used internally to GStreamer to be able to determine which
events and messages are \"the same\". For example, elements may set the seqnum
on a segment-done message to be the same as that of the last seek event, to
indicate that event and the message correspond to the same segment.

This function never returns 'GI.Gst.Constants.SEQNUM_INVALID' (which is 0).
-}
utilSeqnumNext ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    {- ^ __Returns:__ A constantly incrementing 32-bit unsigned integer, which might
overflow at some point. Use 'GI.Gst.Functions.utilSeqnumCompare' to make sure
you handle wraparound correctly. -}
utilSeqnumNext  = liftIO $ do
    result <- gst_util_seqnum_next
    return result


-- function gst_util_seqnum_compare
-- Args : [Arg {argCName = "s1", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A sequence number.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "s2", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Another sequence number.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_seqnum_compare" gst_util_seqnum_compare ::
    Word32 ->                               -- s1 : TBasicType TUInt32
    Word32 ->                               -- s2 : TBasicType TUInt32
    IO Int32

{- |
Compare two sequence numbers, handling wraparound.

The current implementation just returns (gint32)(/@s1@/ - /@s2@/).
-}
utilSeqnumCompare ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@s1@/: A sequence number. -}
    -> Word32
    {- ^ /@s2@/: Another sequence number. -}
    -> m Int32
    {- ^ __Returns:__ A negative number if /@s1@/ is before /@s2@/, 0 if they are equal, or a
positive number if /@s1@/ is after /@s2@/. -}
utilSeqnumCompare s1 s2 = liftIO $ do
    result <- gst_util_seqnum_compare s1 s2
    return result


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

foreign import ccall "gst_util_guint64_to_gdouble" gst_util_guint64_to_gdouble ::
    Word64 ->                               -- value : TBasicType TUInt64
    IO CDouble

{- |
/No description available in the introspection data./
-}
utilGuint64ToGdouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    -> m Double
utilGuint64ToGdouble value = liftIO $ do
    result <- gst_util_guint64_to_gdouble value
    let result' = realToFrac result
    return result'


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

foreign import ccall "gst_util_group_id_next" gst_util_group_id_next ::
    IO Word32

{- |
Return a constantly incrementing group id.

This function is used to generate a new group-id for the
stream-start event.

This function never returns 'GI.Gst.Constants.GROUP_ID_INVALID' (which is 0)
-}
utilGroupIdNext ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    {- ^ __Returns:__ A constantly incrementing unsigned integer, which might
overflow back to 0 at some point. -}
utilGroupIdNext  = liftIO $ do
    result <- gst_util_group_id_next
    return result


-- function gst_util_greatest_common_divisor_int64
-- Args : [Arg {argCName = "a", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "First value as #gint64", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Second value as #gint64", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_greatest_common_divisor_int64" gst_util_greatest_common_divisor_int64 ::
    Int64 ->                                -- a : TBasicType TInt64
    Int64 ->                                -- b : TBasicType TInt64
    IO Int64

{- |
Calculates the greatest common divisor of /@a@/
and /@b@/.
-}
utilGreatestCommonDivisorInt64 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int64
    {- ^ /@a@/: First value as @/gint64/@ -}
    -> Int64
    {- ^ /@b@/: Second value as @/gint64/@ -}
    -> m Int64
    {- ^ __Returns:__ Greatest common divisor of /@a@/ and /@b@/ -}
utilGreatestCommonDivisorInt64 a b = liftIO $ do
    result <- gst_util_greatest_common_divisor_int64 a b
    return result


-- function gst_util_greatest_common_divisor
-- Args : [Arg {argCName = "a", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "First value as #gint", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Second value as #gint", 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_util_greatest_common_divisor" gst_util_greatest_common_divisor ::
    Int32 ->                                -- a : TBasicType TInt
    Int32 ->                                -- b : TBasicType TInt
    IO Int32

{- |
Calculates the greatest common divisor of /@a@/
and /@b@/.
-}
utilGreatestCommonDivisor ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@a@/: First value as @/gint/@ -}
    -> Int32
    {- ^ /@b@/: Second value as @/gint/@ -}
    -> m Int32
    {- ^ __Returns:__ Greatest common divisor of /@a@/ and /@b@/ -}
utilGreatestCommonDivisor a b = liftIO $ do
    result <- gst_util_greatest_common_divisor a b
    return result


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

foreign import ccall "gst_util_get_timestamp" gst_util_get_timestamp ::
    IO Word64

{- |
Get a timestamp as GstClockTime to be used for interval measurements.
The timestamp should not be interpreted in any other way.
-}
utilGetTimestamp ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word64
    {- ^ __Returns:__ the timestamp -}
utilGetTimestamp  = liftIO $ do
    result <- gst_util_get_timestamp
    return result


-- function gst_util_get_object_array
-- Args : [Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object to set the array to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the property to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "array", argType = TInterface (Name {namespace = "GObject", name = "ValueArray"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a return #GValueArray", 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_util_get_object_array" gst_util_get_object_array ::
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    CString ->                              -- name : TBasicType TUTF8
    Ptr (Ptr GObject.ValueArray.ValueArray) -> -- array : TInterface (Name {namespace = "GObject", name = "ValueArray"})
    IO CInt

{- |
Get a property of type @/GST_TYPE_ARRAY/@ and transform it into a
'GI.GObject.Structs.ValueArray.ValueArray'. This allow language bindings to get GST_TYPE_ARRAY
properties which are otherwise not an accessible type.

/Since: 1.12/
-}
utilGetObjectArray ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    a
    {- ^ /@object@/: the object to set the array to -}
    -> T.Text
    {- ^ /@name@/: the name of the property to set -}
    -> m ((Bool, GObject.ValueArray.ValueArray))
utilGetObjectArray object name = liftIO $ do
    object' <- unsafeManagedPtrCastPtr object
    name' <- textToCString name
    array <- allocMem :: IO (Ptr (Ptr GObject.ValueArray.ValueArray))
    result <- gst_util_get_object_array object' name' array
    let result' = (/= 0) result
    array' <- peek array
    array'' <- (wrapBoxed GObject.ValueArray.ValueArray) array'
    touchManagedPtr object
    freeMem name'
    freeMem array
    return (result', array'')


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

foreign import ccall "gst_util_gdouble_to_guint64" gst_util_gdouble_to_guint64 ::
    CDouble ->                              -- value : TBasicType TDouble
    IO Word64

{- |
/No description available in the introspection data./
-}
utilGdoubleToGuint64 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Double
    -> m Word64
utilGdoubleToGuint64 value = liftIO $ do
    let value' = realToFrac value
    result <- gst_util_gdouble_to_guint64 value'
    return result


-- function gst_util_fraction_to_double
-- Args : [Arg {argCName = "src_n", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Fraction numerator as #gint", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_d", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Fraction denominator #gint", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to a #gdouble for the result", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_fraction_to_double" gst_util_fraction_to_double ::
    Int32 ->                                -- src_n : TBasicType TInt
    Int32 ->                                -- src_d : TBasicType TInt
    Ptr CDouble ->                          -- dest : TBasicType TDouble
    IO ()

{- |
Transforms a fraction to a @/gdouble/@.
-}
utilFractionToDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@srcN@/: Fraction numerator as @/gint/@ -}
    -> Int32
    {- ^ /@srcD@/: Fraction denominator @/gint/@ -}
    -> m (Double)
utilFractionToDouble srcN srcD = liftIO $ do
    dest <- allocMem :: IO (Ptr CDouble)
    gst_util_fraction_to_double srcN srcD dest
    dest' <- peek dest
    let dest'' = realToFrac dest'
    freeMem dest
    return dest''


-- function gst_util_fraction_multiply
-- Args : [Arg {argCName = "a_n", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Numerator of first value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "a_d", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Denominator of first value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b_n", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Numerator of second value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b_d", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Denominator of second value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "res_n", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to #gint to hold the result numerator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "res_d", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to #gint to hold the result denominator", 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_util_fraction_multiply" gst_util_fraction_multiply ::
    Int32 ->                                -- a_n : TBasicType TInt
    Int32 ->                                -- a_d : TBasicType TInt
    Int32 ->                                -- b_n : TBasicType TInt
    Int32 ->                                -- b_d : TBasicType TInt
    Ptr Int32 ->                            -- res_n : TBasicType TInt
    Ptr Int32 ->                            -- res_d : TBasicType TInt
    IO CInt

{- |
Multiplies the fractions /@aN@/\//@aD@/ and /@bN@/\//@bD@/ and stores
the result in /@resN@/ and /@resD@/.
-}
utilFractionMultiply ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@aN@/: Numerator of first value -}
    -> Int32
    {- ^ /@aD@/: Denominator of first value -}
    -> Int32
    {- ^ /@bN@/: Numerator of second value -}
    -> Int32
    {- ^ /@bD@/: Denominator of second value -}
    -> m ((Bool, Int32, Int32))
    {- ^ __Returns:__ 'False' on overflow, 'True' otherwise. -}
utilFractionMultiply aN aD bN bD = liftIO $ do
    resN <- allocMem :: IO (Ptr Int32)
    resD <- allocMem :: IO (Ptr Int32)
    result <- gst_util_fraction_multiply aN aD bN bD resN resD
    let result' = (/= 0) result
    resN' <- peek resN
    resD' <- peek resD
    freeMem resN
    freeMem resD
    return (result', resN', resD')


-- function gst_util_fraction_compare
-- Args : [Arg {argCName = "a_n", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Numerator of first value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "a_d", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Denominator of first value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b_n", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Numerator of second value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b_d", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Denominator of second value", 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_util_fraction_compare" gst_util_fraction_compare ::
    Int32 ->                                -- a_n : TBasicType TInt
    Int32 ->                                -- a_d : TBasicType TInt
    Int32 ->                                -- b_n : TBasicType TInt
    Int32 ->                                -- b_d : TBasicType TInt
    IO Int32

{- |
Compares the fractions /@aN@/\//@aD@/ and /@bN@/\//@bD@/ and returns
-1 if a \< b, 0 if a = b and 1 if a > b.
-}
utilFractionCompare ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@aN@/: Numerator of first value -}
    -> Int32
    {- ^ /@aD@/: Denominator of first value -}
    -> Int32
    {- ^ /@bN@/: Numerator of second value -}
    -> Int32
    {- ^ /@bD@/: Denominator of second value -}
    -> m Int32
    {- ^ __Returns:__ -1 if a \< b; 0 if a = b; 1 if a > b. -}
utilFractionCompare aN aD bN bD = liftIO $ do
    result <- gst_util_fraction_compare aN aD bN bD
    return result


-- function gst_util_fraction_add
-- Args : [Arg {argCName = "a_n", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Numerator of first value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "a_d", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Denominator of first value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b_n", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Numerator of second value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "b_d", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Denominator of second value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "res_n", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to #gint to hold the result numerator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "res_d", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Pointer to #gint to hold the result denominator", 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_util_fraction_add" gst_util_fraction_add ::
    Int32 ->                                -- a_n : TBasicType TInt
    Int32 ->                                -- a_d : TBasicType TInt
    Int32 ->                                -- b_n : TBasicType TInt
    Int32 ->                                -- b_d : TBasicType TInt
    Ptr Int32 ->                            -- res_n : TBasicType TInt
    Ptr Int32 ->                            -- res_d : TBasicType TInt
    IO CInt

{- |
Adds the fractions /@aN@/\//@aD@/ and /@bN@/\//@bD@/ and stores
the result in /@resN@/ and /@resD@/.
-}
utilFractionAdd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    {- ^ /@aN@/: Numerator of first value -}
    -> Int32
    {- ^ /@aD@/: Denominator of first value -}
    -> Int32
    {- ^ /@bN@/: Numerator of second value -}
    -> Int32
    {- ^ /@bD@/: Denominator of second value -}
    -> m ((Bool, Int32, Int32))
    {- ^ __Returns:__ 'False' on overflow, 'True' otherwise. -}
utilFractionAdd aN aD bN bD = liftIO $ do
    resN <- allocMem :: IO (Ptr Int32)
    resD <- allocMem :: IO (Ptr Int32)
    result <- gst_util_fraction_add aN aD bN bD resN resD
    let result' = (/= 0) result
    resN' <- peek resN
    resD' <- peek resD
    freeMem resN
    freeMem resD
    return (result', resN', resD')


-- function gst_util_dump_mem
-- Args : [Arg {argCName = "mem", argType = TCArray False (-1) 1 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to the memory to dump", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size of the memory block to dump", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size of the memory block to dump", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_dump_mem" gst_util_dump_mem ::
    Ptr Word8 ->                            -- mem : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- size : TBasicType TUInt
    IO ()

{- |
Dumps the memory block into a hex representation. Useful for debugging.
-}
utilDumpMem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    {- ^ /@mem@/: a pointer to the memory to dump -}
    -> m ()
utilDumpMem mem = liftIO $ do
    let size = fromIntegral $ B.length mem
    mem' <- packByteString mem
    gst_util_dump_mem mem' size
    freeMem mem'
    return ()


-- function gst_util_dump_buffer
-- Args : [Arg {argCName = "buf", argType = TInterface (Name {namespace = "Gst", name = "Buffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstBuffer whose memory to dump", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_dump_buffer" gst_util_dump_buffer ::
    Ptr Gst.Buffer.Buffer ->                -- buf : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO ()

{- |
Dumps the buffer memory into a hex representation. Useful for debugging.

/Since: 1.14/
-}
utilDumpBuffer ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Buffer.Buffer
    {- ^ /@buf@/: a 'GI.Gst.Structs.Buffer.Buffer' whose memory to dump -}
    -> m ()
utilDumpBuffer buf = liftIO $ do
    buf' <- unsafeManagedPtrGetPtr buf
    gst_util_dump_buffer buf'
    touchManagedPtr buf
    return ()


-- function gst_util_double_to_fraction
-- Args : [Arg {argCName = "src", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#gdouble to transform", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_n", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to a #gint to hold the result numerator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "dest_d", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to a #gint to hold the result denominator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_double_to_fraction" gst_util_double_to_fraction ::
    CDouble ->                              -- src : TBasicType TDouble
    Ptr Int32 ->                            -- dest_n : TBasicType TInt
    Ptr Int32 ->                            -- dest_d : TBasicType TInt
    IO ()

{- |
Transforms a @/gdouble/@ to a fraction and simplifies
the result.
-}
utilDoubleToFraction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Double
    {- ^ /@src@/: @/gdouble/@ to transform -}
    -> m ((Int32, Int32))
utilDoubleToFraction src = liftIO $ do
    let src' = realToFrac src
    destN <- allocMem :: IO (Ptr Int32)
    destD <- allocMem :: IO (Ptr Int32)
    gst_util_double_to_fraction src' destN destD
    destN' <- peek destN
    destD' <- peek destD
    freeMem destN
    freeMem destD
    return (destN', destD')


-- function gst_util_array_binary_search
-- Args : [Arg {argCName = "array", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the sorted input array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "num_elements", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of elements in the array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "element_size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "size of every element in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "search_func", argType = TInterface (Name {namespace = "GLib", name = "CompareDataFunc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "function to compare two elements, @search_data will always be passed as second argument", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = 6, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "SearchMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "search mode that should be used", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "search_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "element that should be found", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to @search_func", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "gst_util_array_binary_search" gst_util_array_binary_search ::
    Ptr () ->                               -- array : TBasicType TPtr
    Word32 ->                               -- num_elements : TBasicType TUInt
    Word64 ->                               -- element_size : TBasicType TUInt64
    FunPtr GLib.Callbacks.C_CompareDataFunc -> -- search_func : TInterface (Name {namespace = "GLib", name = "CompareDataFunc"})
    CUInt ->                                -- mode : TInterface (Name {namespace = "Gst", name = "SearchMode"})
    Ptr () ->                               -- search_data : TBasicType TPtr
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO (Ptr ())

{- |
Searches inside /@array@/ for /@searchData@/ by using the comparison function
/@searchFunc@/. /@array@/ must be sorted ascending.

As /@searchData@/ is always passed as second argument to /@searchFunc@/ it\'s
not required that /@searchData@/ has the same type as the array elements.

The complexity of this search function is O(log (num_elements)).
-}
utilArrayBinarySearch ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@array@/: the sorted input array -}
    -> Word32
    {- ^ /@numElements@/: number of elements in the array -}
    -> Word64
    {- ^ /@elementSize@/: size of every element in bytes -}
    -> GLib.Callbacks.CompareDataFunc
    {- ^ /@searchFunc@/: function to compare two elements, /@searchData@/ will always be passed as second argument -}
    -> Gst.Enums.SearchMode
    {- ^ /@mode@/: search mode that should be used -}
    -> Ptr ()
    {- ^ /@searchData@/: element that should be found -}
    -> m (Ptr ())
    {- ^ __Returns:__ The address of the found
element or 'Nothing' if nothing was found -}
utilArrayBinarySearch array numElements elementSize searchFunc mode searchData = liftIO $ do
    searchFunc' <- GLib.Callbacks.mk_CompareDataFunc (GLib.Callbacks.wrap_CompareDataFunc Nothing (GLib.Callbacks.drop_closures_CompareDataFunc searchFunc))
    let mode' = (fromIntegral . fromEnum) mode
    let userData = nullPtr
    result <- gst_util_array_binary_search array numElements elementSize searchFunc' mode' searchData userData
    safeFreeFunPtr $ castFunPtrToPtr searchFunc'
    return result


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

foreign import ccall "gst_update_registry" gst_update_registry ::
    IO CInt

{- |
Forces GStreamer to re-scan its plugin paths and update the default
plugin registry.

Applications will almost never need to call this function, it is only
useful if the application knows new plugins have been installed (or old
ones removed) since the start of the application (or, to be precise, the
first call to 'GI.Gst.Functions.init') and the application wants to make use of any
newly-installed plugins without restarting the application.

Applications should assume that the registry update is neither atomic nor
thread-safe and should therefore not have any dynamic pipelines running
(including the playbin and decodebin elements) and should also not create
any elements or access the GStreamer registry while the update is in
progress.

Note that this function may block for a significant amount of time.
-}
updateRegistry ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True' if the registry has been updated successfully (does not
         imply that there were changes), otherwise 'False'. -}
updateRegistry  = liftIO $ do
    result <- gst_update_registry
    let result' = (/= 0) result
    return result'


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

foreign import ccall "gst_type_find_get_type" gst_type_find_get_type ::
    IO CGType

{- |
/No description available in the introspection data./
-}
typeFindGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GType
typeFindGetType  = liftIO $ do
    result <- gst_type_find_get_type
    let result' = GType result
    return result'


-- function gst_tag_merge_use_first
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "uninitialized GValue to store result in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "src", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "GValue to copy from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_merge_use_first" gst_tag_merge_use_first ::
    Ptr GValue ->                           -- dest : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- src : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
This is a convenience function for the func argument of @/gst_tag_register()/@.
It creates a copy of the first value from the list.
-}
tagMergeUseFirst ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@src@/: GValue to copy from -}
    -> m (GValue)
tagMergeUseFirst src = liftIO $ do
    dest <- callocBoxedBytes 24 :: IO (Ptr GValue)
    src' <- unsafeManagedPtrGetPtr src
    gst_tag_merge_use_first dest src'
    dest' <- (wrapBoxed GValue) dest
    touchManagedPtr src
    return dest'


-- function gst_tag_merge_strings_with_comma
-- Args : [Arg {argCName = "dest", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "uninitialized GValue to store result in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing},Arg {argCName = "src", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "GValue to copy from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_merge_strings_with_comma" gst_tag_merge_strings_with_comma ::
    Ptr GValue ->                           -- dest : TInterface (Name {namespace = "GObject", name = "Value"})
    Ptr GValue ->                           -- src : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
This is a convenience function for the func argument of @/gst_tag_register()/@.
It concatenates all given strings using a comma. The tag must be registered
as a G_TYPE_STRING or this function will fail.
-}
tagMergeStringsWithComma ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    {- ^ /@src@/: GValue to copy from -}
    -> m (GValue)
tagMergeStringsWithComma src = liftIO $ do
    dest <- callocBoxedBytes 24 :: IO (Ptr GValue)
    src' <- unsafeManagedPtrGetPtr src
    gst_tag_merge_strings_with_comma dest src'
    dest' <- (wrapBoxed GValue) dest
    touchManagedPtr src
    return dest'


-- function gst_tag_is_fixed
-- Args : [Arg {argCName = "tag", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "tag to check", 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_tag_is_fixed" gst_tag_is_fixed ::
    CString ->                              -- tag : TBasicType TUTF8
    IO CInt

{- |
Checks if the given tag is fixed. A fixed tag can only contain one value.
Unfixed tags can contain lists of values.
-}
tagIsFixed ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@tag@/: tag to check -}
    -> m Bool
    {- ^ __Returns:__ 'True', if the given tag is fixed. -}
tagIsFixed tag = liftIO $ do
    tag' <- textToCString tag
    result <- gst_tag_is_fixed tag'
    let result' = (/= 0) result
    freeMem tag'
    return result'


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

foreign import ccall "gst_tag_get_type" gst_tag_get_type ::
    CString ->                              -- tag : TBasicType TUTF8
    IO CGType

{- |
Gets the 'GType' used for this tag.
-}
tagGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@tag@/: the tag -}
    -> m GType
    {- ^ __Returns:__ the 'GType' of this tag -}
tagGetType tag = liftIO $ do
    tag' <- textToCString tag
    result <- gst_tag_get_type tag'
    let result' = GType result
    freeMem tag'
    return result'


-- function gst_tag_get_nick
-- Args : [Arg {argCName = "tag", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tag", 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_tag_get_nick" gst_tag_get_nick ::
    CString ->                              -- tag : TBasicType TUTF8
    IO CString

{- |
Returns the human-readable name of this tag, You must not change or free
this string.
-}
tagGetNick ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@tag@/: the tag -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the human-readable name of this tag -}
tagGetNick tag = liftIO $ do
    tag' <- textToCString tag
    result <- gst_tag_get_nick tag'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    freeMem tag'
    return maybeResult


-- function gst_tag_get_flag
-- Args : [Arg {argCName = "tag", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tag", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "TagFlag"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_tag_get_flag" gst_tag_get_flag ::
    CString ->                              -- tag : TBasicType TUTF8
    IO CUInt

{- |
Gets the flag of /@tag@/.
-}
tagGetFlag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@tag@/: the tag -}
    -> m Gst.Enums.TagFlag
    {- ^ __Returns:__ the flag of this tag. -}
tagGetFlag tag = liftIO $ do
    tag' <- textToCString tag
    result <- gst_tag_get_flag tag'
    let result' = (toEnum . fromIntegral) result
    freeMem tag'
    return result'


-- function gst_tag_get_description
-- Args : [Arg {argCName = "tag", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tag", 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_tag_get_description" gst_tag_get_description ::
    CString ->                              -- tag : TBasicType TUTF8
    IO CString

{- |
Returns the human-readable description of this tag, You must not change or
free this string.
-}
tagGetDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@tag@/: the tag -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the human-readable description of this tag -}
tagGetDescription tag = liftIO $ do
    tag' <- textToCString tag
    result <- gst_tag_get_description tag'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    freeMem tag'
    return maybeResult


-- function gst_tag_exists
-- Args : [Arg {argCName = "tag", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of the tag", 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_tag_exists" gst_tag_exists ::
    CString ->                              -- tag : TBasicType TUTF8
    IO CInt

{- |
Checks if the given type is already registered.
-}
tagExists ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@tag@/: name of the tag -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the type is already registered -}
tagExists tag = liftIO $ do
    tag' <- textToCString tag
    result <- gst_tag_exists tag'
    let result' = (/= 0) result
    freeMem tag'
    return result'


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

foreign import ccall "gst_static_pad_template_get_type" gst_static_pad_template_get_type ::
    IO CGType

{- |
/No description available in the introspection data./
-}
staticPadTemplateGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GType
staticPadTemplateGetType  = liftIO $ do
    result <- gst_static_pad_template_get_type
    let result' = GType result
    return result'


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

foreign import ccall "gst_static_caps_get_type" gst_static_caps_get_type ::
    IO CGType

{- |
/No description available in the introspection data./
-}
staticCapsGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GType
staticCapsGetType  = liftIO $ do
    result <- gst_static_caps_get_type
    let result' = GType result
    return result'


-- function gst_segtrap_set_enabled
-- Args : [Arg {argCName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether a custom SIGSEGV handler should be installed.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_segtrap_set_enabled" gst_segtrap_set_enabled ::
    CInt ->                                 -- enabled : TBasicType TBoolean
    IO ()

{- |
Applications might want to disable\/enable the SIGSEGV handling of
the GStreamer core. See 'GI.Gst.Functions.segtrapIsEnabled' for more information.
-}
segtrapSetEnabled ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    {- ^ /@enabled@/: whether a custom SIGSEGV handler should be installed. -}
    -> m ()
segtrapSetEnabled enabled = liftIO $ do
    let enabled' = (fromIntegral . fromEnum) enabled
    gst_segtrap_set_enabled enabled'
    return ()


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

foreign import ccall "gst_segtrap_is_enabled" gst_segtrap_is_enabled ::
    IO CInt

{- |
Some functions in the GStreamer core might install a custom SIGSEGV handler
to better catch and report errors to the application. Currently this feature
is enabled by default when loading plugins.

Applications might want to disable this behaviour with the
'GI.Gst.Functions.segtrapSetEnabled' function. This is typically done if the application
wants to install its own handler without GStreamer interfering.
-}
segtrapIsEnabled ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True' if GStreamer is allowed to install a custom SIGSEGV handler. -}
segtrapIsEnabled  = liftIO $ do
    result <- gst_segtrap_is_enabled
    let result' = (/= 0) result
    return result'


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

foreign import ccall "gst_reference_timestamp_meta_api_get_type" gst_reference_timestamp_meta_api_get_type ::
    IO CGType

{- |
/No description available in the introspection data./
-}
referenceTimestampMetaApiGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GType
referenceTimestampMetaApiGetType  = liftIO $ do
    result <- gst_reference_timestamp_meta_api_get_type
    let result' = GType result
    return result'


-- function gst_protection_select_system
-- Args : [Arg {argCName = "system_identifiers", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A null terminated array of strings\nthat contains the UUID values of each protection system that is to be\nchecked.", 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_protection_select_system" gst_protection_select_system ::
    Ptr CString ->                          -- system_identifiers : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO CString

{- |
Iterates the supplied list of UUIDs and checks the GstRegistry for
an element that supports one of the supplied UUIDs. If more than one
element matches, the system ID of the highest ranked element is selected.

/Since: 1.6/
-}
protectionSelectSystem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [T.Text]
    {- ^ /@systemIdentifiers@/: A null terminated array of strings
that contains the UUID values of each protection system that is to be
checked. -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ One of the strings from
/@systemIdentifiers@/ that indicates the highest ranked element that
implements the protection system indicated by that system ID, or 'Nothing' if no
element has been found. -}
protectionSelectSystem systemIdentifiers = liftIO $ do
    systemIdentifiers' <- packZeroTerminatedUTF8CArray systemIdentifiers
    result <- gst_protection_select_system systemIdentifiers'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    mapZeroTerminatedCArray freeMem systemIdentifiers'
    freeMem systemIdentifiers'
    return maybeResult


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

foreign import ccall "gst_protection_meta_api_get_type" gst_protection_meta_api_get_type ::
    IO CGType

{- |
/No description available in the introspection data./
-}
protectionMetaApiGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GType
protectionMetaApiGetType  = liftIO $ do
    result <- gst_protection_meta_api_get_type
    let result' = GType result
    return result'


-- function gst_protection_filter_systems_by_available_decryptors
-- Args : [Arg {argCName = "system_identifiers", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "\nA null terminated array of strings that contains the UUID values of each\nprotection system that is to be checked.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_protection_filter_systems_by_available_decryptors" gst_protection_filter_systems_by_available_decryptors ::
    Ptr CString ->                          -- system_identifiers : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO (Ptr CString)

{- |
Iterates the supplied list of UUIDs and checks the GstRegistry for
all the decryptors supporting one of the supplied UUIDs.

/Since: 1.14/
-}
protectionFilterSystemsByAvailableDecryptors ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [T.Text]
    {- ^ /@systemIdentifiers@/: 
A null terminated array of strings that contains the UUID values of each
protection system that is to be checked. -}
    -> m (Maybe [T.Text])
    {- ^ __Returns:__ 
A null terminated array containing all
the /@systemIdentifiers@/ supported by the set of available decryptors, or
'Nothing' if no matches were found. -}
protectionFilterSystemsByAvailableDecryptors systemIdentifiers = liftIO $ do
    systemIdentifiers' <- packZeroTerminatedUTF8CArray systemIdentifiers
    result <- gst_protection_filter_systems_by_available_decryptors systemIdentifiers'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- unpackZeroTerminatedUTF8CArray result'
        mapZeroTerminatedCArray freeMem result'
        freeMem result'
        return result''
    mapZeroTerminatedCArray freeMem systemIdentifiers'
    freeMem systemIdentifiers'
    return maybeResult


-- function gst_parse_launchv_full
-- Args : [Arg {argCName = "argv", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "null-terminated array of arguments", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context", argType = TInterface (Name {namespace = "Gst", name = "ParseContext"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a parse context allocated with\n    gst_parse_context_new(), or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "ParseFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "parsing options, or #GST_PARSE_FLAG_NONE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Element"}))
-- throws : True
-- Skip return : False

foreign import ccall "gst_parse_launchv_full" gst_parse_launchv_full ::
    Ptr CString ->                          -- argv : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr Gst.ParseContext.ParseContext ->    -- context : TInterface (Name {namespace = "Gst", name = "ParseContext"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "ParseFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gst.Element.Element)

{- |
Create a new element based on command line syntax.
/@error@/ will contain an error message if an erroneous pipeline is specified.
An error does not mean that the pipeline could not be constructed.
-}
parseLaunchvFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [T.Text]
    {- ^ /@argv@/: null-terminated array of arguments -}
    -> Maybe (Gst.ParseContext.ParseContext)
    {- ^ /@context@/: a parse context allocated with
    'GI.Gst.Structs.ParseContext.parseContextNew', or 'Nothing' -}
    -> [Gst.Flags.ParseFlags]
    {- ^ /@flags@/: parsing options, or @/GST_PARSE_FLAG_NONE/@ -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ a new element on success; on
  failure, either 'Nothing' or a partially-constructed bin or element will be
  returned and /@error@/ will be set (unless you passed
  @/GST_PARSE_FLAG_FATAL_ERRORS/@ in /@flags@/, then 'Nothing' will always be returned
  on failure) /(Can throw 'Data.GI.Base.GError.GError')/ -}
parseLaunchvFull argv context flags = liftIO $ do
    argv' <- packZeroTerminatedUTF8CArray argv
    maybeContext <- case context of
        Nothing -> return nullPtr
        Just jContext -> do
            jContext' <- unsafeManagedPtrGetPtr jContext
            return jContext'
    let flags' = gflagsToWord flags
    onException (do
        result <- propagateGError $ gst_parse_launchv_full argv' maybeContext flags'
        maybeResult <- convertIfNonNull result $ \result' -> do
            result'' <- (newObject Gst.Element.Element) result'
            return result''
        whenJust context touchManagedPtr
        mapZeroTerminatedCArray freeMem argv'
        freeMem argv'
        return maybeResult
     ) (do
        mapZeroTerminatedCArray freeMem argv'
        freeMem argv'
     )


-- function gst_parse_launchv
-- Args : [Arg {argCName = "argv", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "null-terminated array of arguments", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Element"}))
-- throws : True
-- Skip return : False

foreign import ccall "gst_parse_launchv" gst_parse_launchv ::
    Ptr CString ->                          -- argv : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gst.Element.Element)

{- |
Create a new element based on command line syntax.
/@error@/ will contain an error message if an erroneous pipeline is specified.
An error does not mean that the pipeline could not be constructed.
-}
parseLaunchv ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [T.Text]
    {- ^ /@argv@/: null-terminated array of arguments -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ a new element on success and 'Nothing'
on failure. /(Can throw 'Data.GI.Base.GError.GError')/ -}
parseLaunchv argv = liftIO $ do
    argv' <- packZeroTerminatedUTF8CArray argv
    onException (do
        result <- propagateGError $ gst_parse_launchv argv'
        maybeResult <- convertIfNonNull result $ \result' -> do
            result'' <- (newObject Gst.Element.Element) result'
            return result''
        mapZeroTerminatedCArray freeMem argv'
        freeMem argv'
        return maybeResult
     ) (do
        mapZeroTerminatedCArray freeMem argv'
        freeMem argv'
     )


-- function gst_parse_launch_full
-- Args : [Arg {argCName = "pipeline_description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the command line describing the pipeline", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context", argType = TInterface (Name {namespace = "Gst", name = "ParseContext"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a parse context allocated with\n     gst_parse_context_new(), or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "ParseFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "parsing options, or #GST_PARSE_FLAG_NONE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Element"}))
-- throws : True
-- Skip return : False

foreign import ccall "gst_parse_launch_full" gst_parse_launch_full ::
    CString ->                              -- pipeline_description : TBasicType TUTF8
    Ptr Gst.ParseContext.ParseContext ->    -- context : TInterface (Name {namespace = "Gst", name = "ParseContext"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "ParseFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gst.Element.Element)

{- |
Create a new pipeline based on command line syntax.
Please note that you might get a return value that is not 'Nothing' even though
the /@error@/ is set. In this case there was a recoverable parsing error and you
can try to play the pipeline.
-}
parseLaunchFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@pipelineDescription@/: the command line describing the pipeline -}
    -> Maybe (Gst.ParseContext.ParseContext)
    {- ^ /@context@/: a parse context allocated with
     'GI.Gst.Structs.ParseContext.parseContextNew', or 'Nothing' -}
    -> [Gst.Flags.ParseFlags]
    {- ^ /@flags@/: parsing options, or @/GST_PARSE_FLAG_NONE/@ -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ a new element on success, 'Nothing' on
   failure. If more than one toplevel element is specified by the
   /@pipelineDescription@/, all elements are put into a 'GI.Gst.Objects.Pipeline.Pipeline', which
   then is returned (unless the GST_PARSE_FLAG_PLACE_IN_BIN flag is set, in
   which case they are put in a 'GI.Gst.Objects.Bin.Bin' instead). /(Can throw 'Data.GI.Base.GError.GError')/ -}
parseLaunchFull pipelineDescription context flags = liftIO $ do
    pipelineDescription' <- textToCString pipelineDescription
    maybeContext <- case context of
        Nothing -> return nullPtr
        Just jContext -> do
            jContext' <- unsafeManagedPtrGetPtr jContext
            return jContext'
    let flags' = gflagsToWord flags
    onException (do
        result <- propagateGError $ gst_parse_launch_full pipelineDescription' maybeContext flags'
        maybeResult <- convertIfNonNull result $ \result' -> do
            result'' <- (newObject Gst.Element.Element) result'
            return result''
        whenJust context touchManagedPtr
        freeMem pipelineDescription'
        return maybeResult
     ) (do
        freeMem pipelineDescription'
     )


-- function gst_parse_launch
-- Args : [Arg {argCName = "pipeline_description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the command line describing the pipeline", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Element"}))
-- throws : True
-- Skip return : False

foreign import ccall "gst_parse_launch" gst_parse_launch ::
    CString ->                              -- pipeline_description : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gst.Element.Element)

{- |
Create a new pipeline based on command line syntax.
Please note that you might get a return value that is not 'Nothing' even though
the /@error@/ is set. In this case there was a recoverable parsing error and you
can try to play the pipeline.
-}
parseLaunch ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@pipelineDescription@/: the command line describing the pipeline -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ a new element on success, 'Nothing' on
  failure. If more than one toplevel element is specified by the
  /@pipelineDescription@/, all elements are put into a 'GI.Gst.Objects.Pipeline.Pipeline', which
  than is returned. /(Can throw 'Data.GI.Base.GError.GError')/ -}
parseLaunch pipelineDescription = liftIO $ do
    pipelineDescription' <- textToCString pipelineDescription
    onException (do
        result <- propagateGError $ gst_parse_launch pipelineDescription'
        maybeResult <- convertIfNonNull result $ \result' -> do
            result'' <- (newObject Gst.Element.Element) result'
            return result''
        freeMem pipelineDescription'
        return maybeResult
     ) (do
        freeMem pipelineDescription'
     )


-- function gst_parse_bin_from_description_full
-- Args : [Arg {argCName = "bin_description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "command line describing the bin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ghost_unlinked_pads", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether to automatically create ghost pads\n    for unlinked source or sink pads within the bin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context", argType = TInterface (Name {namespace = "Gst", name = "ParseContext"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a parse context allocated with\n    gst_parse_context_new(), or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "ParseFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "parsing options, or #GST_PARSE_FLAG_NONE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Element"}))
-- throws : True
-- Skip return : False

foreign import ccall "gst_parse_bin_from_description_full" gst_parse_bin_from_description_full ::
    CString ->                              -- bin_description : TBasicType TUTF8
    CInt ->                                 -- ghost_unlinked_pads : TBasicType TBoolean
    Ptr Gst.ParseContext.ParseContext ->    -- context : TInterface (Name {namespace = "Gst", name = "ParseContext"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "ParseFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gst.Element.Element)

{- |
This is a convenience wrapper around 'GI.Gst.Functions.parseLaunch' to create a
'GI.Gst.Objects.Bin.Bin' from a gst-launch-style pipeline description. See
'GI.Gst.Functions.parseLaunch' and the gst-launch man page for details about the
syntax. Ghost pads on the bin for unlinked source or sink pads
within the bin can automatically be created (but only a maximum of
one ghost pad for each direction will be created; if you expect
multiple unlinked source pads or multiple unlinked sink pads
and want them all ghosted, you will have to create the ghost pads
yourself).
-}
parseBinFromDescriptionFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@binDescription@/: command line describing the bin -}
    -> Bool
    {- ^ /@ghostUnlinkedPads@/: whether to automatically create ghost pads
    for unlinked source or sink pads within the bin -}
    -> Maybe (Gst.ParseContext.ParseContext)
    {- ^ /@context@/: a parse context allocated with
    'GI.Gst.Structs.ParseContext.parseContextNew', or 'Nothing' -}
    -> [Gst.Flags.ParseFlags]
    {- ^ /@flags@/: parsing options, or @/GST_PARSE_FLAG_NONE/@ -}
    -> m (Maybe Gst.Element.Element)
    {- ^ __Returns:__ a newly-created
  element, which is guaranteed to be a bin unless
  GST_FLAG_NO_SINGLE_ELEMENT_BINS was passed, or 'Nothing' if an error
  occurred. /(Can throw 'Data.GI.Base.GError.GError')/ -}
parseBinFromDescriptionFull binDescription ghostUnlinkedPads context flags = liftIO $ do
    binDescription' <- textToCString binDescription
    let ghostUnlinkedPads' = (fromIntegral . fromEnum) ghostUnlinkedPads
    maybeContext <- case context of
        Nothing -> return nullPtr
        Just jContext -> do
            jContext' <- unsafeManagedPtrGetPtr jContext
            return jContext'
    let flags' = gflagsToWord flags
    onException (do
        result <- propagateGError $ gst_parse_bin_from_description_full binDescription' ghostUnlinkedPads' maybeContext flags'
        maybeResult <- convertIfNonNull result $ \result' -> do
            result'' <- (newObject Gst.Element.Element) result'
            return result''
        whenJust context touchManagedPtr
        freeMem binDescription'
        return maybeResult
     ) (do
        freeMem binDescription'
     )


-- function gst_parse_bin_from_description
-- Args : [Arg {argCName = "bin_description", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "command line describing the bin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ghost_unlinked_pads", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether to automatically create ghost pads\n    for unlinked source or sink pads within the bin", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Bin"}))
-- throws : True
-- Skip return : False

foreign import ccall "gst_parse_bin_from_description" gst_parse_bin_from_description ::
    CString ->                              -- bin_description : TBasicType TUTF8
    CInt ->                                 -- ghost_unlinked_pads : TBasicType TBoolean
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gst.Bin.Bin)

{- |
This is a convenience wrapper around 'GI.Gst.Functions.parseLaunch' to create a
'GI.Gst.Objects.Bin.Bin' from a gst-launch-style pipeline description. See
'GI.Gst.Functions.parseLaunch' and the gst-launch man page for details about the
syntax. Ghost pads on the bin for unlinked source or sink pads
within the bin can automatically be created (but only a maximum of
one ghost pad for each direction will be created; if you expect
multiple unlinked source pads or multiple unlinked sink pads
and want them all ghosted, you will have to create the ghost pads
yourself).
-}
parseBinFromDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@binDescription@/: command line describing the bin -}
    -> Bool
    {- ^ /@ghostUnlinkedPads@/: whether to automatically create ghost pads
    for unlinked source or sink pads within the bin -}
    -> m (Maybe Gst.Bin.Bin)
    {- ^ __Returns:__ a
  newly-created bin, or 'Nothing' if an error occurred. /(Can throw 'Data.GI.Base.GError.GError')/ -}
parseBinFromDescription binDescription ghostUnlinkedPads = liftIO $ do
    binDescription' <- textToCString binDescription
    let ghostUnlinkedPads' = (fromIntegral . fromEnum) ghostUnlinkedPads
    onException (do
        result <- propagateGError $ gst_parse_bin_from_description binDescription' ghostUnlinkedPads'
        maybeResult <- convertIfNonNull result $ \result' -> do
            result'' <- (newObject Gst.Bin.Bin) result'
            return result''
        freeMem binDescription'
        return maybeResult
     ) (do
        freeMem binDescription'
     )


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

foreign import ccall "gst_parent_buffer_meta_api_get_type" gst_parent_buffer_meta_api_get_type ::
    IO CGType

{- |
/No description available in the introspection data./
-}
parentBufferMetaApiGetType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m GType
parentBufferMetaApiGetType  = liftIO $ do
    result <- gst_parent_buffer_meta_api_get_type
    let result' = GType result
    return result'


-- function gst_param_spec_fraction
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "canonical name of the property specified", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "nick", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "nick name for the property specified", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "blurb", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "description of the property specified", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_num", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "minimum value (fraction numerator)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_denom", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "minimum value (fraction denominator)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_num", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "maximum value (fraction numerator)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_denom", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "maximum value (fraction denominator)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "default_num", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "default value (fraction numerator)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "default_denom", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "default value (fraction denominator)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GObject", name = "ParamFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags for the property specified", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TParamSpec
-- throws : False
-- Skip return : False

foreign import ccall "gst_param_spec_fraction" gst_param_spec_fraction ::
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- nick : TBasicType TUTF8
    CString ->                              -- blurb : TBasicType TUTF8
    Int32 ->                                -- min_num : TBasicType TInt
    Int32 ->                                -- min_denom : TBasicType TInt
    Int32 ->                                -- max_num : TBasicType TInt
    Int32 ->                                -- max_denom : TBasicType TInt
    Int32 ->                                -- default_num : TBasicType TInt
    Int32 ->                                -- default_denom : TBasicType TInt
    CUInt ->                                -- flags : TInterface (Name {namespace = "GObject", name = "ParamFlags"})
    IO (Ptr GParamSpec)

{- |
This function creates a fraction GParamSpec for use by objects\/elements
that want to expose properties of fraction type. This function is typically
used in connection with 'GI.GObject.Structs.ObjectClass.objectClassInstallProperty' in a GObjects\'s
instance_init function.
-}
paramSpecFraction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: canonical name of the property specified -}
    -> T.Text
    {- ^ /@nick@/: nick name for the property specified -}
    -> T.Text
    {- ^ /@blurb@/: description of the property specified -}
    -> Int32
    {- ^ /@minNum@/: minimum value (fraction numerator) -}
    -> Int32
    {- ^ /@minDenom@/: minimum value (fraction denominator) -}
    -> Int32
    {- ^ /@maxNum@/: maximum value (fraction numerator) -}
    -> Int32
    {- ^ /@maxDenom@/: maximum value (fraction denominator) -}
    -> Int32
    {- ^ /@defaultNum@/: default value (fraction numerator) -}
    -> Int32
    {- ^ /@defaultDenom@/: default value (fraction denominator) -}
    -> [GObject.Flags.ParamFlags]
    {- ^ /@flags@/: flags for the property specified -}
    -> m (Maybe GParamSpec)
    {- ^ __Returns:__ a newly created parameter specification -}
paramSpecFraction name nick blurb minNum minDenom maxNum maxDenom defaultNum defaultDenom flags = liftIO $ do
    name' <- textToCString name
    nick' <- textToCString nick
    blurb' <- textToCString blurb
    let flags' = gflagsToWord flags
    result <- gst_param_spec_fraction name' nick' blurb' minNum minDenom maxNum maxDenom defaultNum defaultDenom flags'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- B.GParamSpec.wrapGParamSpecPtr result'
        return result''
    freeMem name'
    freeMem nick'
    freeMem blurb'
    return maybeResult


-- function gst_param_spec_array
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "canonical name of the property specified", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "nick", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "nick name for the property specified", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "blurb", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "description of the property specified", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "element_spec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "GParamSpec of the array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GObject", name = "ParamFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags for the property specified", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TParamSpec
-- throws : False
-- Skip return : False

foreign import ccall "gst_param_spec_array" gst_param_spec_array ::
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- nick : TBasicType TUTF8
    CString ->                              -- blurb : TBasicType TUTF8
    Ptr GParamSpec ->                       -- element_spec : TParamSpec
    CUInt ->                                -- flags : TInterface (Name {namespace = "GObject", name = "ParamFlags"})
    IO (Ptr GParamSpec)

{- |
This function creates a GstArray GParamSpec for use by objects\/elements
that want to expose properties of GstArray type. This function is
typically * used in connection with 'GI.GObject.Structs.ObjectClass.objectClassInstallProperty' in a
GObjects\'s instance_init function.

/Since: 1.14/
-}
paramSpecArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: canonical name of the property specified -}
    -> T.Text
    {- ^ /@nick@/: nick name for the property specified -}
    -> T.Text
    {- ^ /@blurb@/: description of the property specified -}
    -> GParamSpec
    {- ^ /@elementSpec@/: GParamSpec of the array -}
    -> [GObject.Flags.ParamFlags]
    {- ^ /@flags@/: flags for the property specified -}
    -> m GParamSpec
    {- ^ __Returns:__ a newly created parameter specification -}
paramSpecArray name nick blurb elementSpec flags = liftIO $ do
    name' <- textToCString name
    nick' <- textToCString nick
    blurb' <- textToCString blurb
    elementSpec' <- unsafeManagedPtrGetPtr elementSpec
    let flags' = gflagsToWord flags
    result <- gst_param_spec_array name' nick' blurb' elementSpec' flags'
    checkUnexpectedReturnNULL "paramSpecArray" result
    result' <- B.GParamSpec.wrapGParamSpecPtr result
    touchManagedPtr elementSpec
    freeMem name'
    freeMem nick'
    freeMem blurb'
    return result'


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

foreign import ccall "gst_is_initialized" gst_is_initialized ::
    IO CInt

{- |
Use this function to check if GStreamer has been initialized with 'GI.Gst.Functions.init'
or 'GI.Gst.Functions.initCheck'.
-}
isInitialized ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True' if initialization has been done, 'False' otherwise. -}
isInitialized  = liftIO $ do
    result <- gst_is_initialized
    let result' = (/= 0) result
    return result'


-- function gst_is_caps_features
-- Args : [Arg {argCName = "obj", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Nothing, 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_caps_features" gst_is_caps_features ::
    Ptr () ->                               -- obj : TBasicType TPtr
    IO CInt

{- |
/No description available in the introspection data./
-}
isCapsFeatures ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -> m Bool
isCapsFeatures obj = liftIO $ do
    result <- gst_is_caps_features obj
    let result' = (/= 0) result
    return result'


-- function gst_init_check
-- Args : [Arg {argCName = "argc", argType = TBasicType TInt, direction = DirectionInout, mayBeNull = True, argDoc = Documentation {rawDocText = Just "pointer to application's argc", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "argv", argType = TCArray False (-1) 0 (TBasicType TUTF8), direction = DirectionInout, mayBeNull = True, argDoc = Documentation {rawDocText = Just "pointer to application's argv", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "argc", argType = TBasicType TInt, direction = DirectionInout, mayBeNull = True, argDoc = Documentation {rawDocText = Just "pointer to application's argc", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "gst_init_check" gst_init_check ::
    Ptr Int32 ->                            -- argc : TBasicType TInt
    Ptr (Ptr CString) ->                    -- argv : TCArray False (-1) 0 (TBasicType TUTF8)
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Initializes the GStreamer library, setting up internal path lists,
registering built-in elements, and loading standard plugins.

This function will return 'False' if GStreamer could not be initialized
for some reason.  If you want your program to fail fatally,
use 'GI.Gst.Functions.init' instead.
-}
initCheck ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe ([T.Text])
    {- ^ /@argv@/: pointer to application\'s argv -}
    -> m ((Maybe [T.Text]))
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
initCheck argv = liftIO $ do
    let argc = case argv of
            Nothing -> 0
            Just jArgv -> fromIntegral $ length jArgv
    argc' <- allocMem :: IO (Ptr Int32)
    poke argc' argc
    maybeArgv <- case argv of
        Nothing -> return nullPtr
        Just jArgv -> do
            jArgv' <- packUTF8CArray jArgv
            return jArgv'
    maybeArgv' <- allocMem :: IO (Ptr (Ptr CString))
    poke maybeArgv' maybeArgv
    onException (do
        _ <- propagateGError $ gst_init_check argc' maybeArgv'
        argc'' <- peek argc'
        maybeArgv'' <- peek maybeArgv'
        maybeMaybeArgv'' <- convertIfNonNull maybeArgv'' $ \maybeArgv''' -> do
            maybeArgv'''' <- (unpackUTF8CArrayWithLength argc'') maybeArgv'''
            (mapCArrayWithLength argc'') freeMem maybeArgv'''
            freeMem maybeArgv'''
            return maybeArgv''''
        freeMem argc'
        freeMem maybeArgv'
        return maybeMaybeArgv''
     ) (do
        freeMem argc'
        freeMem maybeArgv'
     )


-- function gst_init
-- Args : [Arg {argCName = "argc", argType = TBasicType TInt, direction = DirectionInout, mayBeNull = True, argDoc = Documentation {rawDocText = Just "pointer to application's argc", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "argv", argType = TCArray False (-1) 0 (TBasicType TUTF8), direction = DirectionInout, mayBeNull = True, argDoc = Documentation {rawDocText = Just "pointer to application's argv", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : [Arg {argCName = "argc", argType = TBasicType TInt, direction = DirectionInout, mayBeNull = True, argDoc = Documentation {rawDocText = Just "pointer to application's argc", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_init" gst_init ::
    Ptr Int32 ->                            -- argc : TBasicType TInt
    Ptr (Ptr CString) ->                    -- argv : TCArray False (-1) 0 (TBasicType TUTF8)
    IO ()

{- |
Initializes the GStreamer library, setting up internal path lists,
registering built-in elements, and loading standard plugins.

Unless the plugin registry is disabled at compile time, the registry will be
loaded. By default this will also check if the registry cache needs to be
updated and rescan all plugins if needed. See 'GI.Gst.Functions.updateRegistry' for
details and section
\<link linkend=\"gst-running\">Running GStreamer Applications\<\/link>
for how to disable automatic registry updates.

> This function will terminate your program if it was unable to initialize
> GStreamer for some reason.  If you want your program to fall back,
> use 'GI.Gst.Functions.initCheck' instead.

WARNING: This function does not work in the same way as corresponding
functions in other glib-style libraries, such as gtk_init\\(\\). In
particular, unknown command line options cause this function to
abort program execution.
-}
init ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe ([T.Text])
    {- ^ /@argv@/: pointer to application\'s argv -}
    -> m ((Maybe [T.Text]))
init argv = liftIO $ do
    let argc = case argv of
            Nothing -> 0
            Just jArgv -> fromIntegral $ length jArgv
    argc' <- allocMem :: IO (Ptr Int32)
    poke argc' argc
    maybeArgv <- case argv of
        Nothing -> return nullPtr
        Just jArgv -> do
            jArgv' <- packUTF8CArray jArgv
            return jArgv'
    maybeArgv' <- allocMem :: IO (Ptr (Ptr CString))
    poke maybeArgv' maybeArgv
    gst_init argc' maybeArgv'
    argc'' <- peek argc'
    maybeArgv'' <- peek maybeArgv'
    maybeMaybeArgv'' <- convertIfNonNull maybeArgv'' $ \maybeArgv''' -> do
        maybeArgv'''' <- (unpackUTF8CArrayWithLength argc'') maybeArgv'''
        (mapCArrayWithLength argc'') freeMem maybeArgv'''
        freeMem maybeArgv'''
        return maybeArgv''''
    freeMem argc'
    freeMem maybeArgv'
    return maybeMaybeArgv''


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

foreign import ccall "gst_get_main_executable_path" gst_get_main_executable_path ::
    IO CString

{- |
This helper is mostly helpful for plugins that need to
inspect the folder of the main executable to determine
their set of features.

When a plugin is initialized from the gst-plugin-scanner
external process, the returned path will be the same as from the
parent process.

/Since: 1.14/
-}
getMainExecutablePath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m (Maybe T.Text)
    {- ^ __Returns:__ The path of the executable that
  initialized GStreamer, or 'Nothing' if it could not be determined. -}
getMainExecutablePath  = liftIO $ do
    result <- gst_get_main_executable_path
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    return maybeResult


-- function gst_formats_contains
-- Args : [Arg {argCName = "formats", argType = TCArray True (-1) (-1) (TInterface (Name {namespace = "Gst", name = "Format"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The format array to search", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the format to find", 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_formats_contains" gst_formats_contains ::
    Ptr CUInt ->                            -- formats : TCArray True (-1) (-1) (TInterface (Name {namespace = "Gst", name = "Format"}))
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    IO CInt

{- |
See if the given format is inside the format array.
-}
formatsContains ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Gst.Enums.Format]
    {- ^ /@formats@/: The format array to search -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the format to find -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the format is found inside the array -}
formatsContains formats format = liftIO $ do
    let formats' = map (fromIntegral . fromEnum) formats
    formats'' <- packZeroTerminatedStorableArray formats'
    let format' = (fromIntegral . fromEnum) format
    result <- gst_formats_contains formats'' format'
    let result' = (/= 0) result
    freeMem formats''
    return result'


-- function gst_flow_to_quark
-- Args : [Arg {argCName = "ret", argType = TInterface (Name {namespace = "Gst", name = "FlowReturn"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstFlowReturn to get the quark of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "gst_flow_to_quark" gst_flow_to_quark ::
    CInt ->                                 -- ret : TInterface (Name {namespace = "Gst", name = "FlowReturn"})
    IO Word32

{- |
Get the unique quark for the given GstFlowReturn.
-}
flowToQuark ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.FlowReturn
    {- ^ /@ret@/: a 'GI.Gst.Enums.FlowReturn' to get the quark of. -}
    -> m Word32
    {- ^ __Returns:__ the quark associated with the flow return or 0 if an
invalid return was specified. -}
flowToQuark ret = liftIO $ do
    let ret' = (fromIntegral . fromEnum) ret
    result <- gst_flow_to_quark ret'
    return result


-- function gst_flow_get_name
-- Args : [Arg {argCName = "ret", argType = TInterface (Name {namespace = "Gst", name = "FlowReturn"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstFlowReturn to get the name of.", 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_flow_get_name" gst_flow_get_name ::
    CInt ->                                 -- ret : TInterface (Name {namespace = "Gst", name = "FlowReturn"})
    IO CString

{- |
Gets a string representing the given flow return.
-}
flowGetName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.FlowReturn
    {- ^ /@ret@/: a 'GI.Gst.Enums.FlowReturn' to get the name of. -}
    -> m T.Text
    {- ^ __Returns:__ a static string with the name of the flow return. -}
flowGetName ret = liftIO $ do
    let ret' = (fromIntegral . fromEnum) ret
    result <- gst_flow_get_name ret'
    checkUnexpectedReturnNULL "flowGetName" result
    result' <- cstringToText result
    return result'


-- function gst_filename_to_uri
-- Args : [Arg {argCName = "filename", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "absolute or relative file name path", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "gst_filename_to_uri" gst_filename_to_uri ::
    CString ->                              -- filename : TBasicType TFileName
    Ptr (Ptr GError) ->                     -- error
    IO CString

{- |
Similar to 'GI.GLib.Functions.filenameToUri', but attempts to handle relative file paths
as well. Before converting /@filename@/ into an URI, it will be prefixed by
the current working directory if it is a relative path, and then the path
will be canonicalised so that it doesn\'t contain any \'.\/\' or \'..\/\' segments.

On Windows @/filename/@ should be in UTF-8 encoding.
-}
filenameToUri ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    {- ^ /@filename@/: absolute or relative file name path -}
    -> m T.Text
    {- ^ __Returns:__ newly-allocated URI string, or NULL on error. The caller must
  free the URI string with 'GI.GLib.Functions.free' when no longer needed. /(Can throw 'Data.GI.Base.GError.GError')/ -}
filenameToUri filename = liftIO $ do
    filename' <- stringToCString filename
    onException (do
        result <- propagateGError $ gst_filename_to_uri filename'
        checkUnexpectedReturnNULL "filenameToUri" result
        result' <- cstringToText result
        freeMem result
        freeMem filename'
        return result'
     ) (do
        freeMem filename'
     )


-- function gst_error_get_message
-- Args : [Arg {argCName = "domain", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the GStreamer error domain this error belongs to.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "code", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the error code belonging to the domain.", 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_error_get_message" gst_error_get_message ::
    Word32 ->                               -- domain : TBasicType TUInt32
    Int32 ->                                -- code : TBasicType TInt
    IO CString

{- |
Get a string describing the error message in the current locale.
-}
errorGetMessage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@domain@/: the GStreamer error domain this error belongs to. -}
    -> Int32
    {- ^ /@code@/: the error code belonging to the domain. -}
    -> m T.Text
    {- ^ __Returns:__ a newly allocated string describing
    the error message (in UTF-8 encoding) -}
errorGetMessage domain code = liftIO $ do
    result <- gst_error_get_message domain code
    checkUnexpectedReturnNULL "errorGetMessage" result
    result' <- cstringToText result
    freeMem result
    return result'


-- function gst_dynamic_type_register
-- Args : [Arg {argCName = "plugin", argType = TInterface (Name {namespace = "Gst", name = "Plugin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, 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_dynamic_type_register" gst_dynamic_type_register ::
    Ptr Gst.Plugin.Plugin ->                -- plugin : TInterface (Name {namespace = "Gst", name = "Plugin"})
    CGType ->                               -- type : TBasicType TGType
    IO CInt

{- |
/No description available in the introspection data./
-}
dynamicTypeRegister ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Plugin.IsPlugin a) =>
    a
    -> GType
    -> m Bool
dynamicTypeRegister plugin type_ = liftIO $ do
    plugin' <- unsafeManagedPtrCastPtr plugin
    let type_' = gtypeToCGType type_
    result <- gst_dynamic_type_register plugin' type_'
    let result' = (/= 0) result
    touchManagedPtr plugin
    return result'


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

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

{- |
Clean up any resources created by GStreamer in 'GI.Gst.Functions.init'.

It is normally not needed to call this function in a normal application
as the resources will automatically be freed when the program terminates.
This function is therefore mostly used by testsuites and other memory
profiling tools.

After this call GStreamer (including this method) should not be used anymore.
-}
deinit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
deinit  = liftIO $ do
    gst_deinit
    return ()


-- function gst_debug_unset_threshold_for_name
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of the categories to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_unset_threshold_for_name" gst_debug_unset_threshold_for_name ::
    CString ->                              -- name : TBasicType TUTF8
    IO ()

{- |
Resets all categories with the given name back to the default level.
-}
debugUnsetThresholdForName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: name of the categories to set -}
    -> m ()
debugUnsetThresholdForName name = liftIO $ do
    name' <- textToCString name
    gst_debug_unset_threshold_for_name name'
    freeMem name'
    return ()


-- function gst_debug_set_threshold_from_string
-- Args : [Arg {argCName = "list", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "comma-separated list of \"category:level\" pairs to be used\n    as debug logging levels", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "reset", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE to clear all previously-set debug levels before setting\n    new thresholds\n%FALSE if adding the threshold described by @list to the one already set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_set_threshold_from_string" gst_debug_set_threshold_from_string ::
    CString ->                              -- list : TBasicType TUTF8
    CInt ->                                 -- reset : TBasicType TBoolean
    IO ()

{- |
Sets the debug logging wanted in the same form as with the GST_DEBUG
environment variable. You can use wildcards such as \'*\', but note that
the order matters when you use wild cards, e.g. \"foosrc:6,*src:3,*:2\" sets
everything to log level 2.

/Since: 1.2/
-}
debugSetThresholdFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@list@/: comma-separated list of \"category:level\" pairs to be used
    as debug logging levels -}
    -> Bool
    {- ^ /@reset@/: 'True' to clear all previously-set debug levels before setting
    new thresholds
'False' if adding the threshold described by /@list@/ to the one already set. -}
    -> m ()
debugSetThresholdFromString list reset = liftIO $ do
    list' <- textToCString list
    let reset' = (fromIntegral . fromEnum) reset
    gst_debug_set_threshold_from_string list' reset'
    freeMem list'
    return ()


-- function gst_debug_set_threshold_for_name
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of the categories to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "level", argType = TInterface (Name {namespace = "Gst", name = "DebugLevel"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "level to set them to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_set_threshold_for_name" gst_debug_set_threshold_for_name ::
    CString ->                              -- name : TBasicType TUTF8
    CUInt ->                                -- level : TInterface (Name {namespace = "Gst", name = "DebugLevel"})
    IO ()

{- |
Sets all categories which match the given glob style pattern to the given
level.
-}
debugSetThresholdForName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@name@/: name of the categories to set -}
    -> Gst.Enums.DebugLevel
    {- ^ /@level@/: level to set them to -}
    -> m ()
debugSetThresholdForName name level = liftIO $ do
    name' <- textToCString name
    let level' = (fromIntegral . fromEnum) level
    gst_debug_set_threshold_for_name name' level'
    freeMem name'
    return ()


-- function gst_debug_set_default_threshold
-- Args : [Arg {argCName = "level", argType = TInterface (Name {namespace = "Gst", name = "DebugLevel"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "level to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_set_default_threshold" gst_debug_set_default_threshold ::
    CUInt ->                                -- level : TInterface (Name {namespace = "Gst", name = "DebugLevel"})
    IO ()

{- |
Sets the default threshold to the given level and updates all categories to
use this threshold.

This function may be called before 'GI.Gst.Functions.init'.
-}
debugSetDefaultThreshold ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.DebugLevel
    {- ^ /@level@/: level to set -}
    -> m ()
debugSetDefaultThreshold level = liftIO $ do
    let level' = (fromIntegral . fromEnum) level
    gst_debug_set_default_threshold level'
    return ()


-- function gst_debug_set_colored
-- Args : [Arg {argCName = "colored", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Whether to use colored output or not", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_set_colored" gst_debug_set_colored ::
    CInt ->                                 -- colored : TBasicType TBoolean
    IO ()

{- |
Sets or unsets the use of coloured debugging output.
Same as gst_debug_set_color_mode () with the argument being
being GST_DEBUG_COLOR_MODE_ON or GST_DEBUG_COLOR_MODE_OFF.

This function may be called before 'GI.Gst.Functions.init'.
-}
debugSetColored ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    {- ^ /@colored@/: Whether to use colored output or not -}
    -> m ()
debugSetColored colored = liftIO $ do
    let colored' = (fromIntegral . fromEnum) colored
    gst_debug_set_colored colored'
    return ()


-- function gst_debug_set_color_mode_from_string
-- Args : [Arg {argCName = "mode", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The coloring mode for debug output. One of the following:\n\"on\", \"auto\", \"off\", \"disable\", \"unix\".", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_set_color_mode_from_string" gst_debug_set_color_mode_from_string ::
    CString ->                              -- mode : TBasicType TUTF8
    IO ()

{- |
Changes the coloring mode for debug output.

This function may be called before 'GI.Gst.Functions.init'.

/Since: 1.2/
-}
debugSetColorModeFromString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@mode@/: The coloring mode for debug output. One of the following:
\"on\", \"auto\", \"off\", \"disable\", \"unix\". -}
    -> m ()
debugSetColorModeFromString mode = liftIO $ do
    mode' <- textToCString mode
    gst_debug_set_color_mode_from_string mode'
    freeMem mode'
    return ()


-- function gst_debug_set_color_mode
-- Args : [Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "DebugColorMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The coloring mode for debug output. See @GstDebugColorMode.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_set_color_mode" gst_debug_set_color_mode ::
    CUInt ->                                -- mode : TInterface (Name {namespace = "Gst", name = "DebugColorMode"})
    IO ()

{- |
Changes the coloring mode for debug output.

This function may be called before 'GI.Gst.Functions.init'.

/Since: 1.2/
-}
debugSetColorMode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.DebugColorMode
    {- ^ /@mode@/: The coloring mode for debug output. See /@gstDebugColorMode@/. -}
    -> m ()
debugSetColorMode mode = liftIO $ do
    let mode' = (fromIntegral . fromEnum) mode
    gst_debug_set_color_mode mode'
    return ()


-- function gst_debug_set_active
-- Args : [Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Whether to use debugging output or not", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_set_active" gst_debug_set_active ::
    CInt ->                                 -- active : TBasicType TBoolean
    IO ()

{- |
If activated, debugging messages are sent to the debugging
handlers.
It makes sense to deactivate it for speed issues.
> This function is not threadsafe. It makes sense to only call it
during initialization.
-}
debugSetActive ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    {- ^ /@active@/: Whether to use debugging output or not -}
    -> m ()
debugSetActive active = liftIO $ do
    let active' = (fromIntegral . fromEnum) active
    gst_debug_set_active active'
    return ()


-- function gst_debug_ring_buffer_logger_get_logs
-- Args : []
-- Lengths : []
-- returnType : Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_ring_buffer_logger_get_logs" gst_debug_ring_buffer_logger_get_logs ::
    IO (Ptr CString)

{- |
Fetches the current logs per thread from the ring buffer logger. See
'GI.Gst.Functions.debugAddRingBufferLogger' for details.

/Since: 1.14/
-}
debugRingBufferLoggerGetLogs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    {- ^ __Returns:__ NULL-terminated array of
strings with the debug output per thread -}
debugRingBufferLoggerGetLogs  = liftIO $ do
    result <- gst_debug_ring_buffer_logger_get_logs
    checkUnexpectedReturnNULL "debugRingBufferLoggerGetLogs" result
    result' <- unpackZeroTerminatedUTF8CArray result
    mapZeroTerminatedCArray freeMem result
    freeMem result
    return result'


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

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

{- |
Removes any previously added ring buffer logger with
'GI.Gst.Functions.debugAddRingBufferLogger'.

/Since: 1.14/
-}
debugRemoveRingBufferLogger ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
debugRemoveRingBufferLogger  = liftIO $ do
    gst_debug_remove_ring_buffer_logger
    return ()


-- function gst_debug_remove_log_function_by_data
-- Args : [Arg {argCName = "data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data of the log function to remove", 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_debug_remove_log_function_by_data" gst_debug_remove_log_function_by_data ::
    Ptr () ->                               -- data : TBasicType TPtr
    IO Word32

{- |
Removes all registered instances of log functions with the given user data.
-}
debugRemoveLogFunctionByData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@data@/: user data of the log function to remove -}
    -> m Word32
    {- ^ __Returns:__ How many instances of the function were removed -}
debugRemoveLogFunctionByData data_ = liftIO $ do
    result <- gst_debug_remove_log_function_by_data data_
    return result


-- function gst_debug_remove_log_function
-- Args : [Arg {argCName = "func", argType = TInterface (Name {namespace = "Gst", name = "LogFunction"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the log function to remove, or %NULL to\n    remove the default log function", sinceVersion = Nothing}, argScope = ScopeTypeCall, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_remove_log_function" gst_debug_remove_log_function ::
    FunPtr Gst.Callbacks.C_LogFunction ->   -- func : TInterface (Name {namespace = "Gst", name = "LogFunction"})
    IO Word32

{- |
Removes all registered instances of the given logging functions.
-}
debugRemoveLogFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (Gst.Callbacks.LogFunction)
    {- ^ /@func@/: the log function to remove, or 'Nothing' to
    remove the default log function -}
    -> m Word32
    {- ^ __Returns:__ How many instances of the function were removed -}
debugRemoveLogFunction func = liftIO $ do
    maybeFunc <- case func of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jFunc -> do
            jFunc' <- Gst.Callbacks.mk_LogFunction (Gst.Callbacks.wrap_LogFunction Nothing (Gst.Callbacks.drop_closures_LogFunction jFunc))
            return jFunc'
    result <- gst_debug_remove_log_function maybeFunc
    safeFreeFunPtr $ castFunPtrToPtr maybeFunc
    return result


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

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

{- |
If libunwind, glibc backtrace or DbgHelp are present
a stack trace is printed.
-}
debugPrintStackTrace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
debugPrintStackTrace  = liftIO $ do
    gst_debug_print_stack_trace
    return ()


-- function gst_debug_log_default
-- Args : [Arg {argCName = "category", argType = TInterface (Name {namespace = "Gst", name = "DebugCategory"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "category to log", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "level", argType = TInterface (Name {namespace = "Gst", name = "DebugLevel"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "level of the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the file that emitted the message, usually the __FILE__ identifier", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "function", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the function that emitted the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the line from that the message was emitted, usually __LINE__", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the object this message relates to,\n    or %NULL if none", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "DebugMessage"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the actual message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the FILE* to log to", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_log_default" gst_debug_log_default ::
    Ptr Gst.DebugCategory.DebugCategory ->  -- category : TInterface (Name {namespace = "Gst", name = "DebugCategory"})
    CUInt ->                                -- level : TInterface (Name {namespace = "Gst", name = "DebugLevel"})
    CString ->                              -- file : TBasicType TUTF8
    CString ->                              -- function : TBasicType TUTF8
    Int32 ->                                -- line : TBasicType TInt
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    Ptr Gst.DebugMessage.DebugMessage ->    -- message : TInterface (Name {namespace = "Gst", name = "DebugMessage"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

{- |
The default logging handler used by GStreamer. Logging functions get called
whenever a macro like GST_DEBUG or similar is used. By default this function
is setup to output the message and additional info to stderr (or the log file
specified via the GST_DEBUG_FILE environment variable) as received via
/@userData@/.

You can add other handlers by using 'GI.Gst.Functions.debugAddLogFunction'.
And you can remove this handler by calling
gst_debug_remove_log_function(gst_debug_log_default);
-}
debugLogDefault ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    Gst.DebugCategory.DebugCategory
    {- ^ /@category@/: category to log -}
    -> Gst.Enums.DebugLevel
    {- ^ /@level@/: level of the message -}
    -> T.Text
    {- ^ /@file@/: the file that emitted the message, usually the __FILE__ identifier -}
    -> T.Text
    {- ^ /@function@/: the function that emitted the message -}
    -> Int32
    {- ^ /@line@/: the line from that the message was emitted, usually __LINE__ -}
    -> Maybe (a)
    {- ^ /@object@/: the object this message relates to,
    or 'Nothing' if none -}
    -> Gst.DebugMessage.DebugMessage
    {- ^ /@message@/: the actual message -}
    -> Ptr ()
    {- ^ /@userData@/: the FILE* to log to -}
    -> m ()
debugLogDefault category level file function line object message userData = liftIO $ do
    category' <- unsafeManagedPtrGetPtr category
    let level' = (fromIntegral . fromEnum) level
    file' <- textToCString file
    function' <- textToCString function
    maybeObject <- case object of
        Nothing -> return nullPtr
        Just jObject -> do
            jObject' <- unsafeManagedPtrCastPtr jObject
            return jObject'
    message' <- unsafeManagedPtrGetPtr message
    gst_debug_log_default category' level' file' function' line maybeObject message' userData
    touchManagedPtr category
    whenJust object touchManagedPtr
    touchManagedPtr message
    freeMem file'
    freeMem function'
    return ()


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

foreign import ccall "gst_debug_is_colored" gst_debug_is_colored ::
    IO CInt

{- |
Checks if the debugging output should be colored.
-}
debugIsColored ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True', if the debug output should be colored. -}
debugIsColored  = liftIO $ do
    result <- gst_debug_is_colored
    let result' = (/= 0) result
    return result'


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

foreign import ccall "gst_debug_is_active" gst_debug_is_active ::
    IO CInt

{- |
Checks if debugging output is activated.
-}
debugIsActive ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    {- ^ __Returns:__ 'True', if debugging is activated -}
debugIsActive  = liftIO $ do
    result <- gst_debug_is_active
    let result' = (/= 0) result
    return result'


-- function gst_debug_get_stack_trace
-- Args : [Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "StackTraceFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A set of #GstStackTraceFlags to determine how the stack\ntrace should look like. Pass 0 to retrieve a minimal backtrace.", 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_debug_get_stack_trace" gst_debug_get_stack_trace ::
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "StackTraceFlags"})
    IO CString

{- |
/No description available in the introspection data./

/Since: 1.12/
-}
debugGetStackTrace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Gst.Flags.StackTraceFlags]
    {- ^ /@flags@/: A set of 'GI.Gst.Flags.StackTraceFlags' to determine how the stack
trace should look like. Pass 0 to retrieve a minimal backtrace. -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ a stack trace, if libunwind or glibc backtrace are
present, else 'Nothing'. -}
debugGetStackTrace flags = liftIO $ do
    let flags' = gflagsToWord flags
    result <- gst_debug_get_stack_trace flags'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        freeMem result'
        return result''
    return maybeResult


-- function gst_debug_get_default_threshold
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "DebugLevel"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_get_default_threshold" gst_debug_get_default_threshold ::
    IO CUInt

{- |
Returns the default threshold that is used for new categories.
-}
debugGetDefaultThreshold ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Gst.Enums.DebugLevel
    {- ^ __Returns:__ the default threshold level -}
debugGetDefaultThreshold  = liftIO $ do
    result <- gst_debug_get_default_threshold
    let result' = (toEnum . fromIntegral) result
    return result'


-- function gst_debug_get_color_mode
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "DebugColorMode"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_get_color_mode" gst_debug_get_color_mode ::
    IO CUInt

{- |
Changes the coloring mode for debug output.

/Since: 1.2/
-}
debugGetColorMode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Gst.Enums.DebugColorMode
    {- ^ __Returns:__ see /@gstDebugColorMode@/ for possible values. -}
debugGetColorMode  = liftIO $ do
    result <- gst_debug_get_color_mode
    let result' = (toEnum . fromIntegral) result
    return result'


-- function gst_debug_get_all_categories
-- Args : []
-- Lengths : []
-- returnType : Just (TGSList (TInterface (Name {namespace = "Gst", name = "DebugCategory"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_get_all_categories" gst_debug_get_all_categories ::
    IO (Ptr (GSList (Ptr Gst.DebugCategory.DebugCategory)))

{- |
Returns a snapshot of a all categories that are currently in use . This list
may change anytime.
The caller has to free the list after use.
-}
debugGetAllCategories ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [Gst.DebugCategory.DebugCategory]
    {- ^ __Returns:__ the list of
    debug categories -}
debugGetAllCategories  = liftIO $ do
    result <- gst_debug_get_all_categories
    result' <- unpackGSList result
    result'' <- mapM (newPtr Gst.DebugCategory.DebugCategory) result'
    g_slist_free result
    return result''


-- function gst_debug_construct_win_color
-- Args : [Arg {argCName = "colorinfo", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the color info", 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_debug_construct_win_color" gst_debug_construct_win_color ::
    Word32 ->                               -- colorinfo : TBasicType TUInt
    IO Int32

{- |
Constructs an integer that can be used for getting the desired color in
windows\' terminals (cmd.exe). As there is no mean to underline, we simply
ignore this attribute.

This function returns 0 on non-windows machines.
-}
debugConstructWinColor ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@colorinfo@/: the color info -}
    -> m Int32
    {- ^ __Returns:__ an integer containing the color definition -}
debugConstructWinColor colorinfo = liftIO $ do
    result <- gst_debug_construct_win_color colorinfo
    return result


-- function gst_debug_construct_term_color
-- Args : [Arg {argCName = "colorinfo", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the color info", 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_debug_construct_term_color" gst_debug_construct_term_color ::
    Word32 ->                               -- colorinfo : TBasicType TUInt
    IO CString

{- |
Constructs a string that can be used for getting the desired color in color
terminals.
You need to free the string after use.
-}
debugConstructTermColor ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@colorinfo@/: the color info -}
    -> m T.Text
    {- ^ __Returns:__ a string containing the color
    definition -}
debugConstructTermColor colorinfo = liftIO $ do
    result <- gst_debug_construct_term_color colorinfo
    checkUnexpectedReturnNULL "debugConstructTermColor" result
    result' <- cstringToText result
    freeMem result
    return result'


-- function gst_debug_bin_to_dot_file_with_ts
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the top-level pipeline that should be analyzed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "details", argType = TInterface (Name {namespace = "Gst", name = "DebugGraphDetails"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "type of #GstDebugGraphDetails to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file_name", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "output base filename (e.g. \"myplayer\")", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_bin_to_dot_file_with_ts" gst_debug_bin_to_dot_file_with_ts ::
    Ptr Gst.Bin.Bin ->                      -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    CUInt ->                                -- details : TInterface (Name {namespace = "Gst", name = "DebugGraphDetails"})
    CString ->                              -- file_name : TBasicType TFileName
    IO ()

{- |
This works like 'GI.Gst.Functions.debugBinToDotFile', but adds the current timestamp
to the filename, so that it can be used to take multiple snapshots.
-}
debugBinToDotFileWithTs ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Bin.IsBin a) =>
    a
    {- ^ /@bin@/: the top-level pipeline that should be analyzed -}
    -> [Gst.Flags.DebugGraphDetails]
    {- ^ /@details@/: type of 'GI.Gst.Flags.DebugGraphDetails' to use -}
    -> [Char]
    {- ^ /@fileName@/: output base filename (e.g. \"myplayer\") -}
    -> m ()
debugBinToDotFileWithTs bin details fileName = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    let details' = gflagsToWord details
    fileName' <- stringToCString fileName
    gst_debug_bin_to_dot_file_with_ts bin' details' fileName'
    touchManagedPtr bin
    freeMem fileName'
    return ()


-- function gst_debug_bin_to_dot_file
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the top-level pipeline that should be analyzed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "details", argType = TInterface (Name {namespace = "Gst", name = "DebugGraphDetails"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "type of #GstDebugGraphDetails to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "file_name", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "output base filename (e.g. \"myplayer\")", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_bin_to_dot_file" gst_debug_bin_to_dot_file ::
    Ptr Gst.Bin.Bin ->                      -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    CUInt ->                                -- details : TInterface (Name {namespace = "Gst", name = "DebugGraphDetails"})
    CString ->                              -- file_name : TBasicType TFileName
    IO ()

{- |
To aid debugging applications one can use this method to write out the whole
network of gstreamer elements that form the pipeline into an dot file.
This file can be processed with graphviz to get an image.
\<informalexample>\<programlisting>
 dot -Tpng -oimage.png graph_lowlevel.dot
\<\/programlisting>\<\/informalexample>
-}
debugBinToDotFile ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Bin.IsBin a) =>
    a
    {- ^ /@bin@/: the top-level pipeline that should be analyzed -}
    -> [Gst.Flags.DebugGraphDetails]
    {- ^ /@details@/: type of 'GI.Gst.Flags.DebugGraphDetails' to use -}
    -> [Char]
    {- ^ /@fileName@/: output base filename (e.g. \"myplayer\") -}
    -> m ()
debugBinToDotFile bin details fileName = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    let details' = gflagsToWord details
    fileName' <- stringToCString fileName
    gst_debug_bin_to_dot_file bin' details' fileName'
    touchManagedPtr bin
    freeMem fileName'
    return ()


-- function gst_debug_bin_to_dot_data
-- Args : [Arg {argCName = "bin", argType = TInterface (Name {namespace = "Gst", name = "Bin"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the top-level pipeline that should be analyzed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "details", argType = TInterface (Name {namespace = "Gst", name = "DebugGraphDetails"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "type of #GstDebugGraphDetails to use", 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_debug_bin_to_dot_data" gst_debug_bin_to_dot_data ::
    Ptr Gst.Bin.Bin ->                      -- bin : TInterface (Name {namespace = "Gst", name = "Bin"})
    CUInt ->                                -- details : TInterface (Name {namespace = "Gst", name = "DebugGraphDetails"})
    IO CString

{- |
To aid debugging applications one can use this method to obtain the whole
network of gstreamer elements that form the pipeline into an dot file.
This data can be processed with graphviz to get an image.
-}
debugBinToDotData ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Bin.IsBin a) =>
    a
    {- ^ /@bin@/: the top-level pipeline that should be analyzed -}
    -> [Gst.Flags.DebugGraphDetails]
    {- ^ /@details@/: type of 'GI.Gst.Flags.DebugGraphDetails' to use -}
    -> m T.Text
    {- ^ __Returns:__ a string containing the pipeline in graphviz
dot format. -}
debugBinToDotData bin details = liftIO $ do
    bin' <- unsafeManagedPtrCastPtr bin
    let details' = gflagsToWord details
    result <- gst_debug_bin_to_dot_data bin' details'
    checkUnexpectedReturnNULL "debugBinToDotData" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr bin
    return result'


-- function gst_debug_add_ring_buffer_logger
-- Args : [Arg {argCName = "max_size_per_thread", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Maximum size of log per thread in bytes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "thread_timeout", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Timeout for threads in seconds", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_add_ring_buffer_logger" gst_debug_add_ring_buffer_logger ::
    Word32 ->                               -- max_size_per_thread : TBasicType TUInt
    Word32 ->                               -- thread_timeout : TBasicType TUInt
    IO ()

{- |
Adds a memory ringbuffer based debug logger that stores up to
/@maxSizePerThread@/ bytes of logs per thread and times out threads after
/@threadTimeout@/ seconds of inactivity.

Logs can be fetched with 'GI.Gst.Functions.debugRingBufferLoggerGetLogs' and the
logger can be removed again with 'GI.Gst.Functions.debugRemoveRingBufferLogger'.
Only one logger at a time is possible.

/Since: 1.14/
-}
debugAddRingBufferLogger ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@maxSizePerThread@/: Maximum size of log per thread in bytes -}
    -> Word32
    {- ^ /@threadTimeout@/: Timeout for threads in seconds -}
    -> m ()
debugAddRingBufferLogger maxSizePerThread threadTimeout = liftIO $ do
    gst_debug_add_ring_buffer_logger maxSizePerThread threadTimeout
    return ()


-- function gst_debug_add_log_function
-- Args : [Arg {argCName = "func", argType = TInterface (Name {namespace = "Gst", name = "LogFunction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the function to use", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 1, argDestroy = 2, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "notify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "called when @user_data is not used anymore", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_debug_add_log_function" gst_debug_add_log_function ::
    FunPtr Gst.Callbacks.C_LogFunction ->   -- func : TInterface (Name {namespace = "Gst", name = "LogFunction"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Adds the logging function to the list of logging functions.
Be sure to use @/G_GNUC_NO_INSTRUMENT/@ on that function, it is needed.
-}
debugAddLogFunction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Callbacks.LogFunction
    {- ^ /@func@/: the function to use -}
    -> m ()
debugAddLogFunction func = liftIO $ do
    func' <- Gst.Callbacks.mk_LogFunction (Gst.Callbacks.wrap_LogFunction Nothing (Gst.Callbacks.drop_closures_LogFunction func))
    let userData = castFunPtrToPtr func'
    let notify = safeFreeFunPtrPtr
    gst_debug_add_log_function func' userData notify
    return ()