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

Queries can be performed on pads ('GI.Gst.Objects.Pad.padQuery') and elements
('GI.Gst.Objects.Element.elementQuery'). Please note that some queries might need a running
pipeline to work.

Queries can be created using the gst_query_new_*() functions.
Query values can be set using gst_query_set_*(), and parsed using
gst_query_parse_*() helpers.

The following example shows how to query the duration of a pipeline:

=== /C code/
>
>  GstQuery *query;
>  gboolean res;
>  query = gst_query_new_duration (GST_FORMAT_TIME);
>  res = gst_element_query (pipeline, query);
>  if (res) {
>    gint64 duration;
>    gst_query_parse_duration (query, NULL, &duration);
>    g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration));
>  } else {
>    g_print ("duration query failed...");
>  }
>  gst_query_unref (query);

-}

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

module GI.Gst.Structs.Query
    (

-- * Exported types
    Query(..)                               ,
    newZeroQuery                            ,
    noQuery                                 ,


 -- * Methods
-- ** addAllocationMeta #method:addAllocationMeta#

#if ENABLE_OVERLOADING
    QueryAddAllocationMetaMethodInfo        ,
#endif
    queryAddAllocationMeta                  ,


-- ** addAllocationParam #method:addAllocationParam#

#if ENABLE_OVERLOADING
    QueryAddAllocationParamMethodInfo       ,
#endif
    queryAddAllocationParam                 ,


-- ** addAllocationPool #method:addAllocationPool#

#if ENABLE_OVERLOADING
    QueryAddAllocationPoolMethodInfo        ,
#endif
    queryAddAllocationPool                  ,


-- ** addBufferingRange #method:addBufferingRange#

#if ENABLE_OVERLOADING
    QueryAddBufferingRangeMethodInfo        ,
#endif
    queryAddBufferingRange                  ,


-- ** addSchedulingMode #method:addSchedulingMode#

#if ENABLE_OVERLOADING
    QueryAddSchedulingModeMethodInfo        ,
#endif
    queryAddSchedulingMode                  ,


-- ** findAllocationMeta #method:findAllocationMeta#

#if ENABLE_OVERLOADING
    QueryFindAllocationMetaMethodInfo       ,
#endif
    queryFindAllocationMeta                 ,


-- ** getNAllocationMetas #method:getNAllocationMetas#

#if ENABLE_OVERLOADING
    QueryGetNAllocationMetasMethodInfo      ,
#endif
    queryGetNAllocationMetas                ,


-- ** getNAllocationParams #method:getNAllocationParams#

#if ENABLE_OVERLOADING
    QueryGetNAllocationParamsMethodInfo     ,
#endif
    queryGetNAllocationParams               ,


-- ** getNAllocationPools #method:getNAllocationPools#

#if ENABLE_OVERLOADING
    QueryGetNAllocationPoolsMethodInfo      ,
#endif
    queryGetNAllocationPools                ,


-- ** getNBufferingRanges #method:getNBufferingRanges#

#if ENABLE_OVERLOADING
    QueryGetNBufferingRangesMethodInfo      ,
#endif
    queryGetNBufferingRanges                ,


-- ** getNSchedulingModes #method:getNSchedulingModes#

#if ENABLE_OVERLOADING
    QueryGetNSchedulingModesMethodInfo      ,
#endif
    queryGetNSchedulingModes                ,


-- ** getStructure #method:getStructure#

#if ENABLE_OVERLOADING
    QueryGetStructureMethodInfo             ,
#endif
    queryGetStructure                       ,


-- ** hasSchedulingMode #method:hasSchedulingMode#

#if ENABLE_OVERLOADING
    QueryHasSchedulingModeMethodInfo        ,
#endif
    queryHasSchedulingMode                  ,


-- ** hasSchedulingModeWithFlags #method:hasSchedulingModeWithFlags#

#if ENABLE_OVERLOADING
    QueryHasSchedulingModeWithFlagsMethodInfo,
#endif
    queryHasSchedulingModeWithFlags         ,


-- ** newAcceptCaps #method:newAcceptCaps#

    queryNewAcceptCaps                      ,


-- ** newAllocation #method:newAllocation#

    queryNewAllocation                      ,


-- ** newBitrate #method:newBitrate#

    queryNewBitrate                         ,


-- ** newBuffering #method:newBuffering#

    queryNewBuffering                       ,


-- ** newCaps #method:newCaps#

    queryNewCaps                            ,


-- ** newContext #method:newContext#

    queryNewContext                         ,


-- ** newConvert #method:newConvert#

    queryNewConvert                         ,


-- ** newCustom #method:newCustom#

    queryNewCustom                          ,


-- ** newDrain #method:newDrain#

    queryNewDrain                           ,


-- ** newDuration #method:newDuration#

    queryNewDuration                        ,


-- ** newFormats #method:newFormats#

    queryNewFormats                         ,


-- ** newLatency #method:newLatency#

    queryNewLatency                         ,


-- ** newPosition #method:newPosition#

    queryNewPosition                        ,


-- ** newScheduling #method:newScheduling#

    queryNewScheduling                      ,


-- ** newSeeking #method:newSeeking#

    queryNewSeeking                         ,


-- ** newSegment #method:newSegment#

    queryNewSegment                         ,


-- ** newUri #method:newUri#

    queryNewUri                             ,


-- ** parseAcceptCaps #method:parseAcceptCaps#

#if ENABLE_OVERLOADING
    QueryParseAcceptCapsMethodInfo          ,
#endif
    queryParseAcceptCaps                    ,


-- ** parseAcceptCapsResult #method:parseAcceptCapsResult#

#if ENABLE_OVERLOADING
    QueryParseAcceptCapsResultMethodInfo    ,
#endif
    queryParseAcceptCapsResult              ,


-- ** parseAllocation #method:parseAllocation#

#if ENABLE_OVERLOADING
    QueryParseAllocationMethodInfo          ,
#endif
    queryParseAllocation                    ,


-- ** parseBitrate #method:parseBitrate#

#if ENABLE_OVERLOADING
    QueryParseBitrateMethodInfo             ,
#endif
    queryParseBitrate                       ,


-- ** parseBufferingPercent #method:parseBufferingPercent#

#if ENABLE_OVERLOADING
    QueryParseBufferingPercentMethodInfo    ,
#endif
    queryParseBufferingPercent              ,


-- ** parseBufferingRange #method:parseBufferingRange#

#if ENABLE_OVERLOADING
    QueryParseBufferingRangeMethodInfo      ,
#endif
    queryParseBufferingRange                ,


-- ** parseBufferingStats #method:parseBufferingStats#

#if ENABLE_OVERLOADING
    QueryParseBufferingStatsMethodInfo      ,
#endif
    queryParseBufferingStats                ,


-- ** parseCaps #method:parseCaps#

#if ENABLE_OVERLOADING
    QueryParseCapsMethodInfo                ,
#endif
    queryParseCaps                          ,


-- ** parseCapsResult #method:parseCapsResult#

#if ENABLE_OVERLOADING
    QueryParseCapsResultMethodInfo          ,
#endif
    queryParseCapsResult                    ,


-- ** parseContext #method:parseContext#

#if ENABLE_OVERLOADING
    QueryParseContextMethodInfo             ,
#endif
    queryParseContext                       ,


-- ** parseContextType #method:parseContextType#

#if ENABLE_OVERLOADING
    QueryParseContextTypeMethodInfo         ,
#endif
    queryParseContextType                   ,


-- ** parseConvert #method:parseConvert#

#if ENABLE_OVERLOADING
    QueryParseConvertMethodInfo             ,
#endif
    queryParseConvert                       ,


-- ** parseDuration #method:parseDuration#

#if ENABLE_OVERLOADING
    QueryParseDurationMethodInfo            ,
#endif
    queryParseDuration                      ,


-- ** parseLatency #method:parseLatency#

#if ENABLE_OVERLOADING
    QueryParseLatencyMethodInfo             ,
#endif
    queryParseLatency                       ,


-- ** parseNFormats #method:parseNFormats#

#if ENABLE_OVERLOADING
    QueryParseNFormatsMethodInfo            ,
#endif
    queryParseNFormats                      ,


-- ** parseNthAllocationMeta #method:parseNthAllocationMeta#

#if ENABLE_OVERLOADING
    QueryParseNthAllocationMetaMethodInfo   ,
#endif
    queryParseNthAllocationMeta             ,


-- ** parseNthAllocationParam #method:parseNthAllocationParam#

#if ENABLE_OVERLOADING
    QueryParseNthAllocationParamMethodInfo  ,
#endif
    queryParseNthAllocationParam            ,


-- ** parseNthAllocationPool #method:parseNthAllocationPool#

#if ENABLE_OVERLOADING
    QueryParseNthAllocationPoolMethodInfo   ,
#endif
    queryParseNthAllocationPool             ,


-- ** parseNthBufferingRange #method:parseNthBufferingRange#

#if ENABLE_OVERLOADING
    QueryParseNthBufferingRangeMethodInfo   ,
#endif
    queryParseNthBufferingRange             ,


-- ** parseNthFormat #method:parseNthFormat#

#if ENABLE_OVERLOADING
    QueryParseNthFormatMethodInfo           ,
#endif
    queryParseNthFormat                     ,


-- ** parseNthSchedulingMode #method:parseNthSchedulingMode#

#if ENABLE_OVERLOADING
    QueryParseNthSchedulingModeMethodInfo   ,
#endif
    queryParseNthSchedulingMode             ,


-- ** parsePosition #method:parsePosition#

#if ENABLE_OVERLOADING
    QueryParsePositionMethodInfo            ,
#endif
    queryParsePosition                      ,


-- ** parseScheduling #method:parseScheduling#

#if ENABLE_OVERLOADING
    QueryParseSchedulingMethodInfo          ,
#endif
    queryParseScheduling                    ,


-- ** parseSeeking #method:parseSeeking#

#if ENABLE_OVERLOADING
    QueryParseSeekingMethodInfo             ,
#endif
    queryParseSeeking                       ,


-- ** parseSegment #method:parseSegment#

#if ENABLE_OVERLOADING
    QueryParseSegmentMethodInfo             ,
#endif
    queryParseSegment                       ,


-- ** parseUri #method:parseUri#

#if ENABLE_OVERLOADING
    QueryParseUriMethodInfo                 ,
#endif
    queryParseUri                           ,


-- ** parseUriRedirection #method:parseUriRedirection#

#if ENABLE_OVERLOADING
    QueryParseUriRedirectionMethodInfo      ,
#endif
    queryParseUriRedirection                ,


-- ** parseUriRedirectionPermanent #method:parseUriRedirectionPermanent#

#if ENABLE_OVERLOADING
    QueryParseUriRedirectionPermanentMethodInfo,
#endif
    queryParseUriRedirectionPermanent       ,


-- ** removeNthAllocationMeta #method:removeNthAllocationMeta#

#if ENABLE_OVERLOADING
    QueryRemoveNthAllocationMetaMethodInfo  ,
#endif
    queryRemoveNthAllocationMeta            ,


-- ** removeNthAllocationParam #method:removeNthAllocationParam#

#if ENABLE_OVERLOADING
    QueryRemoveNthAllocationParamMethodInfo ,
#endif
    queryRemoveNthAllocationParam           ,


-- ** removeNthAllocationPool #method:removeNthAllocationPool#

#if ENABLE_OVERLOADING
    QueryRemoveNthAllocationPoolMethodInfo  ,
#endif
    queryRemoveNthAllocationPool            ,


-- ** setAcceptCapsResult #method:setAcceptCapsResult#

#if ENABLE_OVERLOADING
    QuerySetAcceptCapsResultMethodInfo      ,
#endif
    querySetAcceptCapsResult                ,


-- ** setBitrate #method:setBitrate#

#if ENABLE_OVERLOADING
    QuerySetBitrateMethodInfo               ,
#endif
    querySetBitrate                         ,


-- ** setBufferingPercent #method:setBufferingPercent#

#if ENABLE_OVERLOADING
    QuerySetBufferingPercentMethodInfo      ,
#endif
    querySetBufferingPercent                ,


-- ** setBufferingRange #method:setBufferingRange#

#if ENABLE_OVERLOADING
    QuerySetBufferingRangeMethodInfo        ,
#endif
    querySetBufferingRange                  ,


-- ** setBufferingStats #method:setBufferingStats#

#if ENABLE_OVERLOADING
    QuerySetBufferingStatsMethodInfo        ,
#endif
    querySetBufferingStats                  ,


-- ** setCapsResult #method:setCapsResult#

#if ENABLE_OVERLOADING
    QuerySetCapsResultMethodInfo            ,
#endif
    querySetCapsResult                      ,


-- ** setContext #method:setContext#

#if ENABLE_OVERLOADING
    QuerySetContextMethodInfo               ,
#endif
    querySetContext                         ,


-- ** setConvert #method:setConvert#

#if ENABLE_OVERLOADING
    QuerySetConvertMethodInfo               ,
#endif
    querySetConvert                         ,


-- ** setDuration #method:setDuration#

#if ENABLE_OVERLOADING
    QuerySetDurationMethodInfo              ,
#endif
    querySetDuration                        ,


-- ** setFormatsv #method:setFormatsv#

#if ENABLE_OVERLOADING
    QuerySetFormatsvMethodInfo              ,
#endif
    querySetFormatsv                        ,


-- ** setLatency #method:setLatency#

#if ENABLE_OVERLOADING
    QuerySetLatencyMethodInfo               ,
#endif
    querySetLatency                         ,


-- ** setNthAllocationParam #method:setNthAllocationParam#

#if ENABLE_OVERLOADING
    QuerySetNthAllocationParamMethodInfo    ,
#endif
    querySetNthAllocationParam              ,


-- ** setNthAllocationPool #method:setNthAllocationPool#

#if ENABLE_OVERLOADING
    QuerySetNthAllocationPoolMethodInfo     ,
#endif
    querySetNthAllocationPool               ,


-- ** setPosition #method:setPosition#

#if ENABLE_OVERLOADING
    QuerySetPositionMethodInfo              ,
#endif
    querySetPosition                        ,


-- ** setScheduling #method:setScheduling#

#if ENABLE_OVERLOADING
    QuerySetSchedulingMethodInfo            ,
#endif
    querySetScheduling                      ,


-- ** setSeeking #method:setSeeking#

#if ENABLE_OVERLOADING
    QuerySetSeekingMethodInfo               ,
#endif
    querySetSeeking                         ,


-- ** setSegment #method:setSegment#

#if ENABLE_OVERLOADING
    QuerySetSegmentMethodInfo               ,
#endif
    querySetSegment                         ,


-- ** setUri #method:setUri#

#if ENABLE_OVERLOADING
    QuerySetUriMethodInfo                   ,
#endif
    querySetUri                             ,


-- ** setUriRedirection #method:setUriRedirection#

#if ENABLE_OVERLOADING
    QuerySetUriRedirectionMethodInfo        ,
#endif
    querySetUriRedirection                  ,


-- ** setUriRedirectionPermanent #method:setUriRedirectionPermanent#

#if ENABLE_OVERLOADING
    QuerySetUriRedirectionPermanentMethodInfo,
#endif
    querySetUriRedirectionPermanent         ,


-- ** writableStructure #method:writableStructure#

#if ENABLE_OVERLOADING
    QueryWritableStructureMethodInfo        ,
#endif
    queryWritableStructure                  ,




 -- * Properties
-- ** miniObject #attr:miniObject#
{- | The parent 'GI.Gst.Structs.MiniObject.MiniObject' type
-}
    getQueryMiniObject                      ,
#if ENABLE_OVERLOADING
    query_miniObject                        ,
#endif


-- ** type #attr:type#
{- | the 'GI.Gst.Enums.QueryType'
-}
    getQueryType                            ,
#if ENABLE_OVERLOADING
    query_type                              ,
#endif
    setQueryType                            ,




    ) 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 {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Flags as Gst.Flags
import {-# SOURCE #-} qualified GI.Gst.Objects.Allocator as Gst.Allocator
import {-# SOURCE #-} qualified GI.Gst.Objects.BufferPool as Gst.BufferPool
import {-# SOURCE #-} qualified GI.Gst.Structs.AllocationParams as Gst.AllocationParams
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.Context as Gst.Context
import {-# SOURCE #-} qualified GI.Gst.Structs.MiniObject as Gst.MiniObject
import {-# SOURCE #-} qualified GI.Gst.Structs.Structure as Gst.Structure

-- | Memory-managed wrapper type.
newtype Query = Query (ManagedPtr Query)
foreign import ccall "gst_query_get_type" c_gst_query_get_type ::
    IO GType

instance BoxedObject Query where
    boxedType _ = c_gst_query_get_type

-- | Construct a `Query` struct initialized to zero.
newZeroQuery :: MonadIO m => m Query
newZeroQuery = liftIO $ callocBoxedBytes 72 >>= wrapBoxed Query

instance tag ~ 'AttrSet => Constructible Query tag where
    new _ attrs = do
        o <- newZeroQuery
        GI.Attributes.set o attrs
        return o


-- | A convenience alias for `Nothing` :: `Maybe` `Query`.
noQuery :: Maybe Query
noQuery = Nothing

{- |
Get the value of the “@mini_object@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' query #miniObject
@
-}
getQueryMiniObject :: MonadIO m => Query -> m Gst.MiniObject.MiniObject
getQueryMiniObject s = liftIO $ withManagedPtr s $ \ptr -> do
    let val = ptr `plusPtr` 0 :: (Ptr Gst.MiniObject.MiniObject)
    val' <- (newPtr Gst.MiniObject.MiniObject) val
    return val'

#if ENABLE_OVERLOADING
data QueryMiniObjectFieldInfo
instance AttrInfo QueryMiniObjectFieldInfo where
    type AttrAllowedOps QueryMiniObjectFieldInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint QueryMiniObjectFieldInfo = (~) (Ptr Gst.MiniObject.MiniObject)
    type AttrBaseTypeConstraint QueryMiniObjectFieldInfo = (~) Query
    type AttrGetType QueryMiniObjectFieldInfo = Gst.MiniObject.MiniObject
    type AttrLabel QueryMiniObjectFieldInfo = "mini_object"
    type AttrOrigin QueryMiniObjectFieldInfo = Query
    attrGet _ = getQueryMiniObject
    attrSet _ = undefined
    attrConstruct = undefined
    attrClear _ = undefined

query_miniObject :: AttrLabelProxy "miniObject"
query_miniObject = AttrLabelProxy

#endif


{- |
Get the value of the “@type@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' query #type
@
-}
getQueryType :: MonadIO m => Query -> m Gst.Enums.QueryType
getQueryType s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 64) :: IO CUInt
    let val' = (toEnum . fromIntegral) val
    return val'

{- |
Set the value of the “@type@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' query [ #type 'Data.GI.Base.Attributes.:=' value ]
@
-}
setQueryType :: MonadIO m => Query -> Gst.Enums.QueryType -> m ()
setQueryType s val = liftIO $ withManagedPtr s $ \ptr -> do
    let val' = (fromIntegral . fromEnum) val
    poke (ptr `plusPtr` 64) (val' :: CUInt)

#if ENABLE_OVERLOADING
data QueryTypeFieldInfo
instance AttrInfo QueryTypeFieldInfo where
    type AttrAllowedOps QueryTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint QueryTypeFieldInfo = (~) Gst.Enums.QueryType
    type AttrBaseTypeConstraint QueryTypeFieldInfo = (~) Query
    type AttrGetType QueryTypeFieldInfo = Gst.Enums.QueryType
    type AttrLabel QueryTypeFieldInfo = "type"
    type AttrOrigin QueryTypeFieldInfo = Query
    attrGet _ = getQueryType
    attrSet _ = setQueryType
    attrConstruct = undefined
    attrClear _ = undefined

query_type :: AttrLabelProxy "type"
query_type = AttrLabelProxy

#endif



#if ENABLE_OVERLOADING
instance O.HasAttributeList Query
type instance O.AttributeList Query = QueryAttributeList
type QueryAttributeList = ('[ '("miniObject", QueryMiniObjectFieldInfo), '("type", QueryTypeFieldInfo)] :: [(Symbol, *)])
#endif

-- method Query::new_accept_caps
-- method type : Constructor
-- Args : [Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a fixed #GstCaps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

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

{- |
Constructs a new query object for querying if /@caps@/ are accepted.

Free-function: @/gst_query_unref()/@
-}
queryNewAcceptCaps ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    {- ^ /@caps@/: a fixed 'GI.Gst.Structs.Caps.Caps' -}
    -> m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewAcceptCaps caps = liftIO $ do
    caps' <- unsafeManagedPtrGetPtr caps
    result <- gst_query_new_accept_caps caps'
    checkUnexpectedReturnNULL "queryNewAcceptCaps" result
    result' <- (wrapBoxed Query) result
    touchManagedPtr caps
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_allocation
-- method type : Constructor
-- Args : [Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the negotiated caps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "need_pool", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return a pool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_allocation" gst_query_new_allocation ::
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    CInt ->                                 -- need_pool : TBasicType TBoolean
    IO (Ptr Query)

{- |
Constructs a new query object for querying the allocation properties.

Free-function: @/gst_query_unref()/@
-}
queryNewAllocation ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    {- ^ /@caps@/: the negotiated caps -}
    -> Bool
    {- ^ /@needPool@/: return a pool -}
    -> m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewAllocation caps needPool = liftIO $ do
    caps' <- unsafeManagedPtrGetPtr caps
    let needPool' = (fromIntegral . fromEnum) needPool
    result <- gst_query_new_allocation caps' needPool'
    checkUnexpectedReturnNULL "queryNewAllocation" result
    result' <- (wrapBoxed Query) result
    touchManagedPtr caps
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_bitrate
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_bitrate" gst_query_new_bitrate ::
    IO (Ptr Query)

{- |
Constructs a new query object for querying the bitrate.

Free-function: @/gst_query_unref()/@

/Since: 1.16/
-}
queryNewBitrate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewBitrate  = liftIO $ do
    result <- gst_query_new_bitrate
    checkUnexpectedReturnNULL "queryNewBitrate" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_buffering
-- method type : Constructor
-- Args : [Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the default #GstFormat for the new query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_buffering" gst_query_new_buffering ::
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    IO (Ptr Query)

{- |
Constructs a new query object for querying the buffering status of
a stream.

Free-function: @/gst_query_unref()/@
-}
queryNewBuffering ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.Format
    {- ^ /@format@/: the default 'GI.Gst.Enums.Format' for the new query -}
    -> m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewBuffering format = liftIO $ do
    let format' = (fromIntegral . fromEnum) format
    result <- gst_query_new_buffering format'
    checkUnexpectedReturnNULL "queryNewBuffering" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_caps
-- method type : Constructor
-- Args : [Arg {argCName = "filter", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a filter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_caps" gst_query_new_caps ::
    Ptr Gst.Caps.Caps ->                    -- filter : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO (Ptr Query)

{- |
Constructs a new query object for querying the caps.

The CAPS query should return the allowable caps for a pad in the context
of the element\'s state, its link to other elements, and the devices or files
it has opened. These caps must be a subset of the pad template caps. In the
NULL state with no links, the CAPS query should ideally return the same caps
as the pad template. In rare circumstances, an object property can affect
the caps returned by the CAPS query, but this is discouraged.

For most filters, the caps returned by CAPS query is directly affected by the
allowed caps on other pads. For demuxers and decoders, the caps returned by
the srcpad\'s getcaps function is directly related to the stream data. Again,
the CAPS query should return the most specific caps it reasonably can, since this
helps with autoplugging.

The /@filter@/ is used to restrict the result caps, only the caps matching
/@filter@/ should be returned from the CAPS query. Specifying a filter might
greatly reduce the amount of processing an element needs to do.

Free-function: @/gst_query_unref()/@
-}
queryNewCaps ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    {- ^ /@filter@/: a filter -}
    -> m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewCaps filter = liftIO $ do
    filter' <- unsafeManagedPtrGetPtr filter
    result <- gst_query_new_caps filter'
    checkUnexpectedReturnNULL "queryNewCaps" result
    result' <- (wrapBoxed Query) result
    touchManagedPtr filter
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_context
-- method type : Constructor
-- Args : [Arg {argCName = "context_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Context type to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_context" gst_query_new_context ::
    CString ->                              -- context_type : TBasicType TUTF8
    IO (Ptr Query)

{- |
Constructs a new query object for querying the pipeline-local context.

Free-function: @/gst_query_unref()/@

/Since: 1.2/
-}
queryNewContext ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@contextType@/: Context type to query -}
    -> m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewContext contextType = liftIO $ do
    contextType' <- textToCString contextType
    result <- gst_query_new_context contextType'
    checkUnexpectedReturnNULL "queryNewContext" result
    result' <- (wrapBoxed Query) result
    freeMem contextType'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_convert
-- method type : Constructor
-- Args : [Arg {argCName = "src_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source #GstFormat for the new query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the value to convert", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the target #GstFormat", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_convert" gst_query_new_convert ::
    CUInt ->                                -- src_format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- value : TBasicType TInt64
    CUInt ->                                -- dest_format : TInterface (Name {namespace = "Gst", name = "Format"})
    IO (Ptr Query)

{- |
Constructs a new convert query object. Use @/gst_query_unref()/@
when done with it. A convert query is used to ask for a conversion between
one format and another.

Free-function: @/gst_query_unref()/@
-}
queryNewConvert ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.Format
    {- ^ /@srcFormat@/: the source 'GI.Gst.Enums.Format' for the new query -}
    -> Int64
    {- ^ /@value@/: the value to convert -}
    -> Gst.Enums.Format
    {- ^ /@destFormat@/: the target 'GI.Gst.Enums.Format' -}
    -> m Query
    {- ^ __Returns:__ a 'GI.Gst.Structs.Query.Query' -}
queryNewConvert srcFormat value destFormat = liftIO $ do
    let srcFormat' = (fromIntegral . fromEnum) srcFormat
    let destFormat' = (fromIntegral . fromEnum) destFormat
    result <- gst_query_new_convert srcFormat' value destFormat'
    checkUnexpectedReturnNULL "queryNewConvert" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_custom
-- method type : Constructor
-- Args : [Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "QueryType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the query type", 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 = True, argDoc = Documentation {rawDocText = Just "a structure for the query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_custom" gst_query_new_custom ::
    CUInt ->                                -- type : TInterface (Name {namespace = "Gst", name = "QueryType"})
    Ptr Gst.Structure.Structure ->          -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Query)

{- |
Constructs a new custom query object. Use @/gst_query_unref()/@
when done with it.

Free-function: @/gst_query_unref()/@
-}
queryNewCustom ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.QueryType
    {- ^ /@type@/: the query type -}
    -> Maybe (Gst.Structure.Structure)
    {- ^ /@structure@/: a structure for the query -}
    -> m (Maybe Query)
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewCustom type_ structure = liftIO $ do
    let type_' = (fromIntegral . fromEnum) type_
    maybeStructure <- case structure of
        Nothing -> return nullPtr
        Just jStructure -> do
            jStructure' <- B.ManagedPtr.disownBoxed jStructure
            return jStructure'
    result <- gst_query_new_custom type_' maybeStructure
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Query) result'
        return result''
    whenJust structure touchManagedPtr
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Query::new_drain
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_drain" gst_query_new_drain ::
    IO (Ptr Query)

{- |
Constructs a new query object for querying the drain state.

Free-function: @/gst_query_unref()/@
-}
queryNewDrain ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewDrain  = liftIO $ do
    result <- gst_query_new_drain
    checkUnexpectedReturnNULL "queryNewDrain" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_duration
-- method type : Constructor
-- Args : [Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstFormat for this duration query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_duration" gst_query_new_duration ::
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    IO (Ptr Query)

{- |
Constructs a new stream duration query object to query in the given format.
Use @/gst_query_unref()/@ when done with it. A duration query will give the
total length of the stream.

Free-function: @/gst_query_unref()/@
-}
queryNewDuration ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.Format
    {- ^ /@format@/: the 'GI.Gst.Enums.Format' for this duration query -}
    -> m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewDuration format = liftIO $ do
    let format' = (fromIntegral . fromEnum) format
    result <- gst_query_new_duration format'
    checkUnexpectedReturnNULL "queryNewDuration" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_formats
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_formats" gst_query_new_formats ::
    IO (Ptr Query)

{- |
Constructs a new query object for querying formats of
the stream.

Free-function: @/gst_query_unref()/@
-}
queryNewFormats ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewFormats  = liftIO $ do
    result <- gst_query_new_formats
    checkUnexpectedReturnNULL "queryNewFormats" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_latency
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_latency" gst_query_new_latency ::
    IO (Ptr Query)

{- |
Constructs a new latency query object.
Use @/gst_query_unref()/@ when done with it. A latency query is usually performed
by sinks to compensate for additional latency introduced by elements in the
pipeline.

Free-function: @/gst_query_unref()/@
-}
queryNewLatency ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Query
    {- ^ __Returns:__ a 'GI.Gst.Structs.Query.Query' -}
queryNewLatency  = liftIO $ do
    result <- gst_query_new_latency
    checkUnexpectedReturnNULL "queryNewLatency" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_position
-- method type : Constructor
-- Args : [Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the default #GstFormat for the new query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_position" gst_query_new_position ::
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    IO (Ptr Query)

{- |
Constructs a new query stream position query object. Use @/gst_query_unref()/@
when done with it. A position query is used to query the current position
of playback in the streams, in some format.

Free-function: @/gst_query_unref()/@
-}
queryNewPosition ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.Format
    {- ^ /@format@/: the default 'GI.Gst.Enums.Format' for the new query -}
    -> m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewPosition format = liftIO $ do
    let format' = (fromIntegral . fromEnum) format
    result <- gst_query_new_position format'
    checkUnexpectedReturnNULL "queryNewPosition" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_scheduling
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_scheduling" gst_query_new_scheduling ::
    IO (Ptr Query)

{- |
Constructs a new query object for querying the scheduling properties.

Free-function: @/gst_query_unref()/@
-}
queryNewScheduling ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewScheduling  = liftIO $ do
    result <- gst_query_new_scheduling
    checkUnexpectedReturnNULL "queryNewScheduling" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_seeking
-- method type : Constructor
-- Args : [Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the default #GstFormat for the new query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_seeking" gst_query_new_seeking ::
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    IO (Ptr Query)

{- |
Constructs a new query object for querying seeking properties of
the stream.

Free-function: @/gst_query_unref()/@
-}
queryNewSeeking ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.Format
    {- ^ /@format@/: the default 'GI.Gst.Enums.Format' for the new query -}
    -> m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewSeeking format = liftIO $ do
    let format' = (fromIntegral . fromEnum) format
    result <- gst_query_new_seeking format'
    checkUnexpectedReturnNULL "queryNewSeeking" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_segment
-- method type : Constructor
-- Args : [Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstFormat for the new query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_segment" gst_query_new_segment ::
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    IO (Ptr Query)

{- |
Constructs a new segment query object. Use @/gst_query_unref()/@
when done with it. A segment query is used to discover information about the
currently configured segment for playback.

Free-function: @/gst_query_unref()/@
-}
queryNewSegment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.Format
    {- ^ /@format@/: the 'GI.Gst.Enums.Format' for the new query -}
    -> m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewSegment format = liftIO $ do
    let format' = (fromIntegral . fromEnum) format
    result <- gst_query_new_segment format'
    checkUnexpectedReturnNULL "queryNewSegment" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::new_uri
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Query"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_new_uri" gst_query_new_uri ::
    IO (Ptr Query)

{- |
Constructs a new query URI query object. Use @/gst_query_unref()/@
when done with it. An URI query is used to query the current URI
that is used by the source or sink.

Free-function: @/gst_query_unref()/@
-}
queryNewUri ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Query
    {- ^ __Returns:__ a new 'GI.Gst.Structs.Query.Query' -}
queryNewUri  = liftIO $ do
    result <- gst_query_new_uri
    checkUnexpectedReturnNULL "queryNewUri" result
    result' <- (wrapBoxed Query) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Query::add_allocation_meta
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "api", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the metadata API", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "API specific parameters", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_add_allocation_meta" gst_query_add_allocation_meta ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CGType ->                               -- api : TBasicType TGType
    Ptr Gst.Structure.Structure ->          -- params : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Add /@api@/ with /@params@/ as one of the supported metadata API to /@query@/.
-}
queryAddAllocationMeta ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> GType
    {- ^ /@api@/: the metadata API -}
    -> Maybe (Gst.Structure.Structure)
    {- ^ /@params@/: API specific parameters -}
    -> m ()
queryAddAllocationMeta query api params = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let api' = gtypeToCGType api
    maybeParams <- case params of
        Nothing -> return nullPtr
        Just jParams -> do
            jParams' <- unsafeManagedPtrGetPtr jParams
            return jParams'
    gst_query_add_allocation_meta query' api' maybeParams
    touchManagedPtr query
    whenJust params touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data QueryAddAllocationMetaMethodInfo
instance (signature ~ (GType -> Maybe (Gst.Structure.Structure) -> m ()), MonadIO m) => O.MethodInfo QueryAddAllocationMetaMethodInfo Query signature where
    overloadedMethod _ = queryAddAllocationMeta

#endif

-- method Query::add_allocation_param
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allocator", argType = TInterface (Name {namespace = "Gst", name = "Allocator"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the memory allocator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TInterface (Name {namespace = "Gst", name = "AllocationParams"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #GstAllocationParams", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_add_allocation_param" gst_query_add_allocation_param ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr Gst.Allocator.Allocator ->          -- allocator : TInterface (Name {namespace = "Gst", name = "Allocator"})
    Ptr Gst.AllocationParams.AllocationParams -> -- params : TInterface (Name {namespace = "Gst", name = "AllocationParams"})
    IO ()

{- |
Add /@allocator@/ and its /@params@/ as a supported memory allocator.
-}
queryAddAllocationParam ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Allocator.IsAllocator a) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> Maybe (a)
    {- ^ /@allocator@/: the memory allocator -}
    -> Maybe (Gst.AllocationParams.AllocationParams)
    {- ^ /@params@/: a 'GI.Gst.Structs.AllocationParams.AllocationParams' -}
    -> m ()
queryAddAllocationParam query allocator params = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    maybeAllocator <- case allocator of
        Nothing -> return nullPtr
        Just jAllocator -> do
            jAllocator' <- unsafeManagedPtrCastPtr jAllocator
            return jAllocator'
    maybeParams <- case params of
        Nothing -> return nullPtr
        Just jParams -> do
            jParams' <- unsafeManagedPtrGetPtr jParams
            return jParams'
    gst_query_add_allocation_param query' maybeAllocator maybeParams
    touchManagedPtr query
    whenJust allocator touchManagedPtr
    whenJust params touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data QueryAddAllocationParamMethodInfo
instance (signature ~ (Maybe (a) -> Maybe (Gst.AllocationParams.AllocationParams) -> m ()), MonadIO m, Gst.Allocator.IsAllocator a) => O.MethodInfo QueryAddAllocationParamMethodInfo Query signature where
    overloadedMethod _ = queryAddAllocationParam

#endif

-- method Query::add_allocation_pool
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstQuery of type GST_QUERY_ALLOCATION.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the #GstBufferPool", 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 buffer size", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_buffers", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the min buffers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_buffers", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the max buffers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_add_allocation_pool" gst_query_add_allocation_pool ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr Gst.BufferPool.BufferPool ->        -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
    Word32 ->                               -- size : TBasicType TUInt
    Word32 ->                               -- min_buffers : TBasicType TUInt
    Word32 ->                               -- max_buffers : TBasicType TUInt
    IO ()

{- |
Set the pool parameters in /@query@/.
-}
queryAddAllocationPool ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.BufferPool.IsBufferPool a) =>
    Query
    {- ^ /@query@/: A valid 'GI.Gst.Structs.Query.Query' of type GST_QUERY_ALLOCATION. -}
    -> Maybe (a)
    {- ^ /@pool@/: the 'GI.Gst.Objects.BufferPool.BufferPool' -}
    -> Word32
    {- ^ /@size@/: the buffer size -}
    -> Word32
    {- ^ /@minBuffers@/: the min buffers -}
    -> Word32
    {- ^ /@maxBuffers@/: the max buffers -}
    -> m ()
queryAddAllocationPool query pool size minBuffers maxBuffers = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    maybePool <- case pool of
        Nothing -> return nullPtr
        Just jPool -> do
            jPool' <- unsafeManagedPtrCastPtr jPool
            return jPool'
    gst_query_add_allocation_pool query' maybePool size minBuffers maxBuffers
    touchManagedPtr query
    whenJust pool touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data QueryAddAllocationPoolMethodInfo
instance (signature ~ (Maybe (a) -> Word32 -> Word32 -> Word32 -> m ()), MonadIO m, Gst.BufferPool.IsBufferPool a) => O.MethodInfo QueryAddAllocationPoolMethodInfo Query signature where
    overloadedMethod _ = queryAddAllocationPool

#endif

-- method Query::add_buffering_range
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_BUFFERING type query #GstQuery", 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 "start position of the range", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stop", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "stop position of the range", 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_query_add_buffering_range" gst_query_add_buffering_range ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Int64 ->                                -- start : TBasicType TInt64
    Int64 ->                                -- stop : TBasicType TInt64
    IO CInt

{- |
Set the buffering-ranges array field in /@query@/. The current last
start position of the array should be inferior to /@start@/.
-}
queryAddBufferingRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_BUFFERING type query 'GI.Gst.Structs.Query.Query' -}
    -> Int64
    {- ^ /@start@/: start position of the range -}
    -> Int64
    {- ^ /@stop@/: stop position of the range -}
    -> m Bool
    {- ^ __Returns:__ a 'Bool' indicating if the range was added or not. -}
queryAddBufferingRange query start stop = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_query_add_buffering_range query' start stop
    let result' = (/= 0) result
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data QueryAddBufferingRangeMethodInfo
instance (signature ~ (Int64 -> Int64 -> m Bool), MonadIO m) => O.MethodInfo QueryAddBufferingRangeMethodInfo Query signature where
    overloadedMethod _ = queryAddBufferingRange

#endif

-- method Query::add_scheduling_mode
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_SCHEDULING type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "PadMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPadMode", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_add_scheduling_mode" gst_query_add_scheduling_mode ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- mode : TInterface (Name {namespace = "Gst", name = "PadMode"})
    IO ()

{- |
Add /@mode@/ as one of the supported scheduling modes to /@query@/.
-}
queryAddSchedulingMode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_SCHEDULING type query 'GI.Gst.Structs.Query.Query' -}
    -> Gst.Enums.PadMode
    {- ^ /@mode@/: a 'GI.Gst.Enums.PadMode' -}
    -> m ()
queryAddSchedulingMode query mode = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let mode' = (fromIntegral . fromEnum) mode
    gst_query_add_scheduling_mode query' mode'
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QueryAddSchedulingModeMethodInfo
instance (signature ~ (Gst.Enums.PadMode -> m ()), MonadIO m) => O.MethodInfo QueryAddSchedulingModeMethodInfo Query signature where
    overloadedMethod _ = queryAddSchedulingMode

#endif

-- method Query::find_allocation_meta
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "api", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the metadata API", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the index", 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_query_find_allocation_meta" gst_query_find_allocation_meta ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CGType ->                               -- api : TBasicType TGType
    Ptr Word32 ->                           -- index : TBasicType TUInt
    IO CInt

{- |
Check if /@query@/ has metadata /@api@/ set. When this function returns 'True',
/@index@/ will contain the index where the requested API and the parameters
can be found.
-}
queryFindAllocationMeta ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> GType
    {- ^ /@api@/: the metadata API -}
    -> m ((Bool, Word32))
    {- ^ __Returns:__ 'True' when /@api@/ is in the list of metadata. -}
queryFindAllocationMeta query api = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let api' = gtypeToCGType api
    index <- allocMem :: IO (Ptr Word32)
    result <- gst_query_find_allocation_meta query' api' index
    let result' = (/= 0) result
    index' <- peek index
    touchManagedPtr query
    freeMem index
    return (result', index')

#if ENABLE_OVERLOADING
data QueryFindAllocationMetaMethodInfo
instance (signature ~ (GType -> m ((Bool, Word32))), MonadIO m) => O.MethodInfo QueryFindAllocationMetaMethodInfo Query signature where
    overloadedMethod _ = queryFindAllocationMeta

#endif

-- method Query::get_n_allocation_metas
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", 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_query_get_n_allocation_metas" gst_query_get_n_allocation_metas ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO Word32

{- |
Retrieve the number of values currently stored in the
meta API array of the query\'s structure.
-}
queryGetNAllocationMetas ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> m Word32
    {- ^ __Returns:__ the metadata API array size as a @/guint/@. -}
queryGetNAllocationMetas query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_query_get_n_allocation_metas query'
    touchManagedPtr query
    return result

#if ENABLE_OVERLOADING
data QueryGetNAllocationMetasMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo QueryGetNAllocationMetasMethodInfo Query signature where
    overloadedMethod _ = queryGetNAllocationMetas

#endif

-- method Query::get_n_allocation_params
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", 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_query_get_n_allocation_params" gst_query_get_n_allocation_params ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO Word32

{- |
Retrieve the number of values currently stored in the
allocator params array of the query\'s structure.

If no memory allocator is specified, the downstream element can handle
the default memory allocator. The first memory allocator in the query
should be generic and allow mapping to system memory, all following
allocators should be ordered by preference with the preferred one first.
-}
queryGetNAllocationParams ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> m Word32
    {- ^ __Returns:__ the allocator array size as a @/guint/@. -}
queryGetNAllocationParams query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_query_get_n_allocation_params query'
    touchManagedPtr query
    return result

#if ENABLE_OVERLOADING
data QueryGetNAllocationParamsMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo QueryGetNAllocationParamsMethodInfo Query signature where
    overloadedMethod _ = queryGetNAllocationParams

#endif

-- method Query::get_n_allocation_pools
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", 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_query_get_n_allocation_pools" gst_query_get_n_allocation_pools ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO Word32

{- |
Retrieve the number of values currently stored in the
pool array of the query\'s structure.
-}
queryGetNAllocationPools ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> m Word32
    {- ^ __Returns:__ the pool array size as a @/guint/@. -}
queryGetNAllocationPools query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_query_get_n_allocation_pools query'
    touchManagedPtr query
    return result

#if ENABLE_OVERLOADING
data QueryGetNAllocationPoolsMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo QueryGetNAllocationPoolsMethodInfo Query signature where
    overloadedMethod _ = queryGetNAllocationPools

#endif

-- method Query::get_n_buffering_ranges
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_BUFFERING type query #GstQuery", 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_query_get_n_buffering_ranges" gst_query_get_n_buffering_ranges ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO Word32

{- |
Retrieve the number of values currently stored in the
buffered-ranges array of the query\'s structure.
-}
queryGetNBufferingRanges ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_BUFFERING type query 'GI.Gst.Structs.Query.Query' -}
    -> m Word32
    {- ^ __Returns:__ the range array size as a @/guint/@. -}
queryGetNBufferingRanges query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_query_get_n_buffering_ranges query'
    touchManagedPtr query
    return result

#if ENABLE_OVERLOADING
data QueryGetNBufferingRangesMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo QueryGetNBufferingRangesMethodInfo Query signature where
    overloadedMethod _ = queryGetNBufferingRanges

#endif

-- method Query::get_n_scheduling_modes
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_SCHEDULING type query #GstQuery", 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_query_get_n_scheduling_modes" gst_query_get_n_scheduling_modes ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO Word32

{- |
Retrieve the number of values currently stored in the
scheduling mode array of the query\'s structure.
-}
queryGetNSchedulingModes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_SCHEDULING type query 'GI.Gst.Structs.Query.Query' -}
    -> m Word32
    {- ^ __Returns:__ the scheduling mode array size as a @/guint/@. -}
queryGetNSchedulingModes query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_query_get_n_scheduling_modes query'
    touchManagedPtr query
    return result

#if ENABLE_OVERLOADING
data QueryGetNSchedulingModesMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo QueryGetNSchedulingModesMethodInfo Query signature where
    overloadedMethod _ = queryGetNSchedulingModes

#endif

-- method Query::get_structure
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", 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_query_get_structure" gst_query_get_structure ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO (Ptr Gst.Structure.Structure)

{- |
Get the structure of a query.
-}
queryGetStructure ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m (Maybe Gst.Structure.Structure)
    {- ^ __Returns:__ the 'GI.Gst.Structs.Structure.Structure' of the query. The
    structure is still owned by the query and will therefore be freed when the
    query is unreffed. -}
queryGetStructure query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_query_get_structure query'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Gst.Structure.Structure) result'
        return result''
    touchManagedPtr query
    return maybeResult

#if ENABLE_OVERLOADING
data QueryGetStructureMethodInfo
instance (signature ~ (m (Maybe Gst.Structure.Structure)), MonadIO m) => O.MethodInfo QueryGetStructureMethodInfo Query signature where
    overloadedMethod _ = queryGetStructure

#endif

-- method Query::has_scheduling_mode
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_SCHEDULING type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "PadMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the scheduling mode", 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_query_has_scheduling_mode" gst_query_has_scheduling_mode ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- mode : TInterface (Name {namespace = "Gst", name = "PadMode"})
    IO CInt

{- |
Check if /@query@/ has scheduling mode set.

> When checking if upstream supports pull mode, it is usually not
> enough to just check for GST_PAD_MODE_PULL with this function, you
> also want to check whether the scheduling flags returned by
> 'GI.Gst.Structs.Query.queryParseScheduling' have the seeking flag set (meaning
> random access is supported, not only sequential pulls).
-}
queryHasSchedulingMode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_SCHEDULING type query 'GI.Gst.Structs.Query.Query' -}
    -> Gst.Enums.PadMode
    {- ^ /@mode@/: the scheduling mode -}
    -> m Bool
    {- ^ __Returns:__ 'True' when /@mode@/ is in the list of scheduling modes. -}
queryHasSchedulingMode query mode = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let mode' = (fromIntegral . fromEnum) mode
    result <- gst_query_has_scheduling_mode query' mode'
    let result' = (/= 0) result
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data QueryHasSchedulingModeMethodInfo
instance (signature ~ (Gst.Enums.PadMode -> m Bool), MonadIO m) => O.MethodInfo QueryHasSchedulingModeMethodInfo Query signature where
    overloadedMethod _ = queryHasSchedulingMode

#endif

-- method Query::has_scheduling_mode_with_flags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_SCHEDULING type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "PadMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the scheduling mode", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "SchedulingFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstSchedulingFlags", 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_query_has_scheduling_mode_with_flags" gst_query_has_scheduling_mode_with_flags ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- mode : TInterface (Name {namespace = "Gst", name = "PadMode"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "SchedulingFlags"})
    IO CInt

{- |
Check if /@query@/ has scheduling mode set and /@flags@/ is set in
query scheduling flags.
-}
queryHasSchedulingModeWithFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_SCHEDULING type query 'GI.Gst.Structs.Query.Query' -}
    -> Gst.Enums.PadMode
    {- ^ /@mode@/: the scheduling mode -}
    -> [Gst.Flags.SchedulingFlags]
    {- ^ /@flags@/: 'GI.Gst.Flags.SchedulingFlags' -}
    -> m Bool
    {- ^ __Returns:__ 'True' when /@mode@/ is in the list of scheduling modes
   and /@flags@/ are compatible with query flags. -}
queryHasSchedulingModeWithFlags query mode flags = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let mode' = (fromIntegral . fromEnum) mode
    let flags' = gflagsToWord flags
    result <- gst_query_has_scheduling_mode_with_flags query' mode' flags'
    let result' = (/= 0) result
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data QueryHasSchedulingModeWithFlagsMethodInfo
instance (signature ~ (Gst.Enums.PadMode -> [Gst.Flags.SchedulingFlags] -> m Bool), MonadIO m) => O.MethodInfo QueryHasSchedulingModeWithFlagsMethodInfo Query signature where
    overloadedMethod _ = queryHasSchedulingModeWithFlags

#endif

-- method Query::parse_accept_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The query to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to the caps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

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

{- |
Get the caps from /@query@/. The caps remains valid as long as /@query@/ remains
valid.
-}
queryParseAcceptCaps ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: The query to parse -}
    -> m (Gst.Caps.Caps)
queryParseAcceptCaps query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    caps <- allocMem :: IO (Ptr (Ptr Gst.Caps.Caps))
    gst_query_parse_accept_caps query' caps
    caps' <- peek caps
    caps'' <- (newBoxed Gst.Caps.Caps) caps'
    touchManagedPtr query
    freeMem caps
    return caps''

#if ENABLE_OVERLOADING
data QueryParseAcceptCapsMethodInfo
instance (signature ~ (m (Gst.Caps.Caps)), MonadIO m) => O.MethodInfo QueryParseAcceptCapsMethodInfo Query signature where
    overloadedMethod _ = queryParseAcceptCaps

#endif

-- method Query::parse_accept_caps_result
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ACCEPT_CAPS type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location 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_query_parse_accept_caps_result" gst_query_parse_accept_caps_result ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CInt ->                             -- result : TBasicType TBoolean
    IO ()

{- |
Parse the result from /@query@/ and store in /@result@/.
-}
queryParseAcceptCapsResult ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ACCEPT_CAPS type query 'GI.Gst.Structs.Query.Query' -}
    -> m (Bool)
queryParseAcceptCapsResult query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result_ <- allocMem :: IO (Ptr CInt)
    gst_query_parse_accept_caps_result query' result_
    result_' <- peek result_
    let result_'' = (/= 0) result_'
    touchManagedPtr query
    freeMem result_
    return result_''

#if ENABLE_OVERLOADING
data QueryParseAcceptCapsResultMethodInfo
instance (signature ~ (m (Bool)), MonadIO m) => O.MethodInfo QueryParseAcceptCapsResultMethodInfo Query signature where
    overloadedMethod _ = queryParseAcceptCapsResult

#endif

-- method Query::parse_allocation
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstCaps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "need_pool", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Whether a #GstBufferPool is needed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_allocation" gst_query_parse_allocation ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr (Ptr Gst.Caps.Caps) ->              -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    Ptr CInt ->                             -- need_pool : TBasicType TBoolean
    IO ()

{- |
Parse an allocation query, writing the requested caps in /@caps@/ and
whether a pool is needed in /@needPool@/, if the respective parameters
are non-'Nothing'.

Pool details can be retrieved using 'GI.Gst.Structs.Query.queryGetNAllocationPools' and
'GI.Gst.Structs.Query.queryParseNthAllocationPool'.
-}
queryParseAllocation ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m ((Gst.Caps.Caps, Bool))
queryParseAllocation query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    caps <- allocMem :: IO (Ptr (Ptr Gst.Caps.Caps))
    needPool <- allocMem :: IO (Ptr CInt)
    gst_query_parse_allocation query' caps needPool
    caps' <- peek caps
    caps'' <- (newBoxed Gst.Caps.Caps) caps'
    needPool' <- peek needPool
    let needPool'' = (/= 0) needPool'
    touchManagedPtr query
    freeMem caps
    freeMem needPool
    return (caps'', needPool'')

#if ENABLE_OVERLOADING
data QueryParseAllocationMethodInfo
instance (signature ~ (m ((Gst.Caps.Caps, Bool))), MonadIO m) => O.MethodInfo QueryParseAllocationMethodInfo Query signature where
    overloadedMethod _ = queryParseAllocation

#endif

-- method Query::parse_bitrate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_BITRATE type #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "nominal_bitrate", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The resulting bitrate in bits per second", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_bitrate" gst_query_parse_bitrate ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr Word32 ->                           -- nominal_bitrate : TBasicType TUInt
    IO ()

{- |
Get the results of a bitrate query. See also 'GI.Gst.Structs.Query.querySetBitrate'.

/Since: 1.16/
-}
queryParseBitrate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_BITRATE type 'GI.Gst.Structs.Query.Query' -}
    -> m (Word32)
queryParseBitrate query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    nominalBitrate <- allocMem :: IO (Ptr Word32)
    gst_query_parse_bitrate query' nominalBitrate
    nominalBitrate' <- peek nominalBitrate
    touchManagedPtr query
    freeMem nominalBitrate
    return nominalBitrate'

#if ENABLE_OVERLOADING
data QueryParseBitrateMethodInfo
instance (signature ~ (m (Word32)), MonadIO m) => O.MethodInfo QueryParseBitrateMethodInfo Query signature where
    overloadedMethod _ = queryParseBitrate

#endif

-- method Query::parse_buffering_percent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstQuery of type GST_QUERY_BUFFERING.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "busy", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if buffering is busy, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "percent", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a buffering percent, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_buffering_percent" gst_query_parse_buffering_percent ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CInt ->                             -- busy : TBasicType TBoolean
    Ptr Int32 ->                            -- percent : TBasicType TInt
    IO ()

{- |
Get the percentage of buffered data. This is a value between 0 and 100.
The /@busy@/ indicator is 'True' when the buffering is in progress.
-}
queryParseBufferingPercent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: A valid 'GI.Gst.Structs.Query.Query' of type GST_QUERY_BUFFERING. -}
    -> m ((Bool, Int32))
queryParseBufferingPercent query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    busy <- allocMem :: IO (Ptr CInt)
    percent <- allocMem :: IO (Ptr Int32)
    gst_query_parse_buffering_percent query' busy percent
    busy' <- peek busy
    let busy'' = (/= 0) busy'
    percent' <- peek percent
    touchManagedPtr query
    freeMem busy
    freeMem percent
    return (busy'', percent')

#if ENABLE_OVERLOADING
data QueryParseBufferingPercentMethodInfo
instance (signature ~ (m ((Bool, Int32))), MonadIO m) => O.MethodInfo QueryParseBufferingPercentMethodInfo Query signature where
    overloadedMethod _ = queryParseBufferingPercent

#endif

-- method Query::parse_buffering_range
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_BUFFERING type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the format to set for the @segment_start\n    and @segment_end values, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "start", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start to set, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "stop", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stop to set, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "estimated_total", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "estimated total amount of download\n    time remaining in milliseconds, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_buffering_range" gst_query_parse_buffering_range ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- start : TBasicType TInt64
    Ptr Int64 ->                            -- stop : TBasicType TInt64
    Ptr Int64 ->                            -- estimated_total : TBasicType TInt64
    IO ()

{- |
Parse an available query, writing the format into /@format@/, and
other results into the passed parameters, if the respective parameters
are non-'Nothing'
-}
queryParseBufferingRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_BUFFERING type query 'GI.Gst.Structs.Query.Query' -}
    -> m ((Gst.Enums.Format, Int64, Int64, Int64))
queryParseBufferingRange query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    format <- allocMem :: IO (Ptr CUInt)
    start <- allocMem :: IO (Ptr Int64)
    stop <- allocMem :: IO (Ptr Int64)
    estimatedTotal <- allocMem :: IO (Ptr Int64)
    gst_query_parse_buffering_range query' format start stop estimatedTotal
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    start' <- peek start
    stop' <- peek stop
    estimatedTotal' <- peek estimatedTotal
    touchManagedPtr query
    freeMem format
    freeMem start
    freeMem stop
    freeMem estimatedTotal
    return (format'', start', stop', estimatedTotal')

#if ENABLE_OVERLOADING
data QueryParseBufferingRangeMethodInfo
instance (signature ~ (m ((Gst.Enums.Format, Int64, Int64, Int64))), MonadIO m) => O.MethodInfo QueryParseBufferingRangeMethodInfo Query signature where
    overloadedMethod _ = queryParseBufferingRange

#endif

-- method Query::parse_buffering_stats
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstQuery of type GST_QUERY_BUFFERING.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "BufferingMode"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a buffering mode, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "avg_in", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the average input rate, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "avg_out", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the average output rat, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "buffering_left", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "amount of buffering time left in\n    milliseconds, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_buffering_stats" gst_query_parse_buffering_stats ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CUInt ->                            -- mode : TInterface (Name {namespace = "Gst", name = "BufferingMode"})
    Ptr Int32 ->                            -- avg_in : TBasicType TInt
    Ptr Int32 ->                            -- avg_out : TBasicType TInt
    Ptr Int64 ->                            -- buffering_left : TBasicType TInt64
    IO ()

{- |
Extracts the buffering stats values from /@query@/.
-}
queryParseBufferingStats ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: A valid 'GI.Gst.Structs.Query.Query' of type GST_QUERY_BUFFERING. -}
    -> m ((Gst.Enums.BufferingMode, Int32, Int32, Int64))
queryParseBufferingStats query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    mode <- allocMem :: IO (Ptr CUInt)
    avgIn <- allocMem :: IO (Ptr Int32)
    avgOut <- allocMem :: IO (Ptr Int32)
    bufferingLeft <- allocMem :: IO (Ptr Int64)
    gst_query_parse_buffering_stats query' mode avgIn avgOut bufferingLeft
    mode' <- peek mode
    let mode'' = (toEnum . fromIntegral) mode'
    avgIn' <- peek avgIn
    avgOut' <- peek avgOut
    bufferingLeft' <- peek bufferingLeft
    touchManagedPtr query
    freeMem mode
    freeMem avgIn
    freeMem avgOut
    freeMem bufferingLeft
    return (mode'', avgIn', avgOut', bufferingLeft')

#if ENABLE_OVERLOADING
data QueryParseBufferingStatsMethodInfo
instance (signature ~ (m ((Gst.Enums.BufferingMode, Int32, Int32, Int64))), MonadIO m) => O.MethodInfo QueryParseBufferingStatsMethodInfo Query signature where
    overloadedMethod _ = queryParseBufferingStats

#endif

-- method Query::parse_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The query to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filter", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to the caps filter", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_caps" gst_query_parse_caps ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr (Ptr Gst.Caps.Caps) ->              -- filter : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO ()

{- |
Get the filter from the caps /@query@/. The caps remains valid as long as
/@query@/ remains valid.
-}
queryParseCaps ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: The query to parse -}
    -> m (Gst.Caps.Caps)
queryParseCaps query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    filter <- allocMem :: IO (Ptr (Ptr Gst.Caps.Caps))
    gst_query_parse_caps query' filter
    filter' <- peek filter
    filter'' <- (newBoxed Gst.Caps.Caps) filter'
    touchManagedPtr query
    freeMem filter
    return filter''

#if ENABLE_OVERLOADING
data QueryParseCapsMethodInfo
instance (signature ~ (m (Gst.Caps.Caps)), MonadIO m) => O.MethodInfo QueryParseCapsMethodInfo Query signature where
    overloadedMethod _ = queryParseCaps

#endif

-- method Query::parse_caps_result
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The query to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to the caps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

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

{- |
Get the caps result from /@query@/. The caps remains valid as long as
/@query@/ remains valid.
-}
queryParseCapsResult ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: The query to parse -}
    -> m (Gst.Caps.Caps)
queryParseCapsResult query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    caps <- allocMem :: IO (Ptr (Ptr Gst.Caps.Caps))
    gst_query_parse_caps_result query' caps
    caps' <- peek caps
    caps'' <- (newBoxed Gst.Caps.Caps) caps'
    touchManagedPtr query
    freeMem caps
    return caps''

#if ENABLE_OVERLOADING
data QueryParseCapsResultMethodInfo
instance (signature ~ (m (Gst.Caps.Caps)), MonadIO m) => O.MethodInfo QueryParseCapsResultMethodInfo Query signature where
    overloadedMethod _ = queryParseCapsResult

#endif

-- method Query::parse_context
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The query to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context", argType = TInterface (Name {namespace = "Gst", name = "Context"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to store the #GstContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_context" gst_query_parse_context ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr (Ptr Gst.Context.Context) ->        -- context : TInterface (Name {namespace = "Gst", name = "Context"})
    IO ()

{- |
Get the context from the context /@query@/. The context remains valid as long as
/@query@/ remains valid.

/Since: 1.2/
-}
queryParseContext ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: The query to parse -}
    -> m (Gst.Context.Context)
queryParseContext query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    context <- allocMem :: IO (Ptr (Ptr Gst.Context.Context))
    gst_query_parse_context query' context
    context' <- peek context
    context'' <- (newBoxed Gst.Context.Context) context'
    touchManagedPtr query
    freeMem context
    return context''

#if ENABLE_OVERLOADING
data QueryParseContextMethodInfo
instance (signature ~ (m (Gst.Context.Context)), MonadIO m) => O.MethodInfo QueryParseContextMethodInfo Query signature where
    overloadedMethod _ = queryParseContext

#endif

-- method Query::parse_context_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_CONTEXT type query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context_type", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the context type, or %NULL", 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_query_parse_context_type" gst_query_parse_context_type ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CString ->                          -- context_type : TBasicType TUTF8
    IO CInt

{- |
Parse a context type from an existing GST_QUERY_CONTEXT query.

/Since: 1.2/
-}
queryParseContextType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_CONTEXT type query -}
    -> m ((Bool, T.Text))
    {- ^ __Returns:__ a 'Bool' indicating if the parsing succeeded. -}
queryParseContextType query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    contextType <- allocMem :: IO (Ptr CString)
    result <- gst_query_parse_context_type query' contextType
    let result' = (/= 0) result
    contextType' <- peek contextType
    contextType'' <- cstringToText contextType'
    touchManagedPtr query
    freeMem contextType
    return (result', contextType'')

#if ENABLE_OVERLOADING
data QueryParseContextTypeMethodInfo
instance (signature ~ (m ((Bool, T.Text))), MonadIO m) => O.MethodInfo QueryParseContextTypeMethodInfo Query signature where
    overloadedMethod _ = queryParseContextType

#endif

-- method Query::parse_convert
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the #GstFormat of the\n    source value, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "src_value", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the source value, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "dest_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the #GstFormat of the\n    destination value, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "dest_value", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the destination value,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_convert" gst_query_parse_convert ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CUInt ->                            -- src_format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- src_value : TBasicType TInt64
    Ptr CUInt ->                            -- dest_format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- dest_value : TBasicType TInt64
    IO ()

{- |
Parse a convert query answer. Any of /@srcFormat@/, /@srcValue@/, /@destFormat@/,
and /@destValue@/ may be 'Nothing', in which case that value is omitted.
-}
queryParseConvert ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m ((Gst.Enums.Format, Int64, Gst.Enums.Format, Int64))
queryParseConvert query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    srcFormat <- allocMem :: IO (Ptr CUInt)
    srcValue <- allocMem :: IO (Ptr Int64)
    destFormat <- allocMem :: IO (Ptr CUInt)
    destValue <- allocMem :: IO (Ptr Int64)
    gst_query_parse_convert query' srcFormat srcValue destFormat destValue
    srcFormat' <- peek srcFormat
    let srcFormat'' = (toEnum . fromIntegral) srcFormat'
    srcValue' <- peek srcValue
    destFormat' <- peek destFormat
    let destFormat'' = (toEnum . fromIntegral) destFormat'
    destValue' <- peek destValue
    touchManagedPtr query
    freeMem srcFormat
    freeMem srcValue
    freeMem destFormat
    freeMem destValue
    return (srcFormat'', srcValue', destFormat'', destValue')

#if ENABLE_OVERLOADING
data QueryParseConvertMethodInfo
instance (signature ~ (m ((Gst.Enums.Format, Int64, Gst.Enums.Format, Int64))), MonadIO m) => O.MethodInfo QueryParseConvertMethodInfo Query signature where
    overloadedMethod _ = queryParseConvert

#endif

-- method Query::parse_duration
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the #GstFormat of the duration\n    value, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "duration", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the total duration, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_duration" gst_query_parse_duration ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- duration : TBasicType TInt64
    IO ()

{- |
Parse a duration query answer. Write the format of the duration into /@format@/,
and the value into /@duration@/, if the respective variables are non-'Nothing'.
-}
queryParseDuration ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m ((Gst.Enums.Format, Int64))
queryParseDuration query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    format <- allocMem :: IO (Ptr CUInt)
    duration <- allocMem :: IO (Ptr Int64)
    gst_query_parse_duration query' format duration
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    duration' <- peek duration
    touchManagedPtr query
    freeMem format
    freeMem duration
    return (format'', duration')

#if ENABLE_OVERLOADING
data QueryParseDurationMethodInfo
instance (signature ~ (m ((Gst.Enums.Format, Int64))), MonadIO m) => O.MethodInfo QueryParseDurationMethodInfo Query signature where
    overloadedMethod _ = queryParseDuration

#endif

-- method Query::parse_latency
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "live", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "storage for live or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "min_latency", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the min latency or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "max_latency", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the max latency or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_latency" gst_query_parse_latency ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CInt ->                             -- live : TBasicType TBoolean
    Ptr Word64 ->                           -- min_latency : TBasicType TUInt64
    Ptr Word64 ->                           -- max_latency : TBasicType TUInt64
    IO ()

{- |
Parse a latency query answer.
-}
queryParseLatency ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m ((Bool, Word64, Word64))
queryParseLatency query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    live <- allocMem :: IO (Ptr CInt)
    minLatency <- allocMem :: IO (Ptr Word64)
    maxLatency <- allocMem :: IO (Ptr Word64)
    gst_query_parse_latency query' live minLatency maxLatency
    live' <- peek live
    let live'' = (/= 0) live'
    minLatency' <- peek minLatency
    maxLatency' <- peek maxLatency
    touchManagedPtr query
    freeMem live
    freeMem minLatency
    freeMem maxLatency
    return (live'', minLatency', maxLatency')

#if ENABLE_OVERLOADING
data QueryParseLatencyMethodInfo
instance (signature ~ (m ((Bool, Word64, Word64))), MonadIO m) => O.MethodInfo QueryParseLatencyMethodInfo Query signature where
    overloadedMethod _ = queryParseLatency

#endif

-- method Query::parse_n_formats
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_formats", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of formats in this query.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_n_formats" gst_query_parse_n_formats ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr Word32 ->                           -- n_formats : TBasicType TUInt
    IO ()

{- |
Parse the number of formats in the formats /@query@/.
-}
queryParseNFormats ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m (Word32)
queryParseNFormats query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    nFormats <- allocMem :: IO (Ptr Word32)
    gst_query_parse_n_formats query' nFormats
    nFormats' <- peek nFormats
    touchManagedPtr query
    freeMem nFormats
    return nFormats'

#if ENABLE_OVERLOADING
data QueryParseNFormatsMethodInfo
instance (signature ~ (m (Word32)), MonadIO m) => O.MethodInfo QueryParseNFormatsMethodInfo Query signature where
    overloadedMethod _ = queryParseNFormats

#endif

-- method Query::parse_nth_allocation_meta
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "position in the metadata API array to read", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "API specific parameters", 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_query_parse_nth_allocation_meta" gst_query_parse_nth_allocation_meta ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    Ptr (Ptr Gst.Structure.Structure) ->    -- params : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO CGType

{- |
Parse an available query and get the metadata API
at /@index@/ of the metadata API array.
-}
queryParseNthAllocationMeta ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@index@/: position in the metadata API array to read -}
    -> m ((GType, Gst.Structure.Structure))
    {- ^ __Returns:__ a 'GType' of the metadata API at /@index@/. -}
queryParseNthAllocationMeta query index = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    params <- allocMem :: IO (Ptr (Ptr Gst.Structure.Structure))
    result <- gst_query_parse_nth_allocation_meta query' index params
    let result' = GType result
    params' <- peek params
    params'' <- (newBoxed Gst.Structure.Structure) params'
    touchManagedPtr query
    freeMem params
    return (result', params'')

#if ENABLE_OVERLOADING
data QueryParseNthAllocationMetaMethodInfo
instance (signature ~ (Word32 -> m ((GType, Gst.Structure.Structure))), MonadIO m) => O.MethodInfo QueryParseNthAllocationMetaMethodInfo Query signature where
    overloadedMethod _ = queryParseNthAllocationMeta

#endif

-- method Query::parse_nth_allocation_param
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "position in the allocator array to read", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allocator", argType = TInterface (Name {namespace = "Gst", name = "Allocator"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "variable to hold the result", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "params", argType = TInterface (Name {namespace = "Gst", name = "AllocationParams"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "parameters for the allocator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_nth_allocation_param" gst_query_parse_nth_allocation_param ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    Ptr (Ptr Gst.Allocator.Allocator) ->    -- allocator : TInterface (Name {namespace = "Gst", name = "Allocator"})
    Ptr Gst.AllocationParams.AllocationParams -> -- params : TInterface (Name {namespace = "Gst", name = "AllocationParams"})
    IO ()

{- |
Parse an available query and get the allocator and its params
at /@index@/ of the allocator array.
-}
queryParseNthAllocationParam ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@index@/: position in the allocator array to read -}
    -> m ((Gst.Allocator.Allocator, Gst.AllocationParams.AllocationParams))
queryParseNthAllocationParam query index = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    allocator <- allocMem :: IO (Ptr (Ptr Gst.Allocator.Allocator))
    params <- callocBoxedBytes 64 :: IO (Ptr Gst.AllocationParams.AllocationParams)
    gst_query_parse_nth_allocation_param query' index allocator params
    allocator' <- peek allocator
    allocator'' <- (wrapObject Gst.Allocator.Allocator) allocator'
    params' <- (wrapBoxed Gst.AllocationParams.AllocationParams) params
    touchManagedPtr query
    freeMem allocator
    return (allocator'', params')

#if ENABLE_OVERLOADING
data QueryParseNthAllocationParamMethodInfo
instance (signature ~ (Word32 -> m ((Gst.Allocator.Allocator, Gst.AllocationParams.AllocationParams))), MonadIO m) => O.MethodInfo QueryParseNthAllocationParamMethodInfo Query signature where
    overloadedMethod _ = queryParseNthAllocationParam

#endif

-- method Query::parse_nth_allocation_pool
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstQuery of type GST_QUERY_ALLOCATION.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "index to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstBufferPool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "size", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the buffer size", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "min_buffers", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the min buffers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "max_buffers", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the max buffers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_nth_allocation_pool" gst_query_parse_nth_allocation_pool ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    Ptr (Ptr Gst.BufferPool.BufferPool) ->  -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
    Ptr Word32 ->                           -- size : TBasicType TUInt
    Ptr Word32 ->                           -- min_buffers : TBasicType TUInt
    Ptr Word32 ->                           -- max_buffers : TBasicType TUInt
    IO ()

{- |
Get the pool parameters in /@query@/.

Unref /@pool@/ with 'GI.Gst.Objects.Object.objectUnref' when it\'s not needed any more.
-}
queryParseNthAllocationPool ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: A valid 'GI.Gst.Structs.Query.Query' of type GST_QUERY_ALLOCATION. -}
    -> Word32
    {- ^ /@index@/: index to parse -}
    -> m ((Gst.BufferPool.BufferPool, Word32, Word32, Word32))
queryParseNthAllocationPool query index = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    pool <- allocMem :: IO (Ptr (Ptr Gst.BufferPool.BufferPool))
    size <- allocMem :: IO (Ptr Word32)
    minBuffers <- allocMem :: IO (Ptr Word32)
    maxBuffers <- allocMem :: IO (Ptr Word32)
    gst_query_parse_nth_allocation_pool query' index pool size minBuffers maxBuffers
    pool' <- peek pool
    pool'' <- (wrapObject Gst.BufferPool.BufferPool) pool'
    size' <- peek size
    minBuffers' <- peek minBuffers
    maxBuffers' <- peek maxBuffers
    touchManagedPtr query
    freeMem pool
    freeMem size
    freeMem minBuffers
    freeMem maxBuffers
    return (pool'', size', minBuffers', maxBuffers')

#if ENABLE_OVERLOADING
data QueryParseNthAllocationPoolMethodInfo
instance (signature ~ (Word32 -> m ((Gst.BufferPool.BufferPool, Word32, Word32, Word32))), MonadIO m) => O.MethodInfo QueryParseNthAllocationPoolMethodInfo Query signature where
    overloadedMethod _ = queryParseNthAllocationPool

#endif

-- method Query::parse_nth_buffering_range
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_BUFFERING type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "position in the buffered-ranges array to read", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start position to set, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "stop", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stop position to set, or %NULL", 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_query_parse_nth_buffering_range" gst_query_parse_nth_buffering_range ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    Ptr Int64 ->                            -- start : TBasicType TInt64
    Ptr Int64 ->                            -- stop : TBasicType TInt64
    IO CInt

{- |
Parse an available query and get the start and stop values stored
at the /@index@/ of the buffered ranges array.
-}
queryParseNthBufferingRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_BUFFERING type query 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@index@/: position in the buffered-ranges array to read -}
    -> m ((Bool, Int64, Int64))
    {- ^ __Returns:__ a 'Bool' indicating if the parsing succeeded. -}
queryParseNthBufferingRange query index = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    start <- allocMem :: IO (Ptr Int64)
    stop <- allocMem :: IO (Ptr Int64)
    result <- gst_query_parse_nth_buffering_range query' index start stop
    let result' = (/= 0) result
    start' <- peek start
    stop' <- peek stop
    touchManagedPtr query
    freeMem start
    freeMem stop
    return (result', start', stop')

#if ENABLE_OVERLOADING
data QueryParseNthBufferingRangeMethodInfo
instance (signature ~ (Word32 -> m ((Bool, Int64, Int64))), MonadIO m) => O.MethodInfo QueryParseNthBufferingRangeMethodInfo Query signature where
    overloadedMethod _ = queryParseNthBufferingRange

#endif

-- method Query::parse_nth_format
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "nth", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the nth format to retrieve.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to store the nth format", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_nth_format" gst_query_parse_nth_format ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- nth : TBasicType TUInt
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    IO ()

{- |
Parse the format query and retrieve the /@nth@/ format from it into
/@format@/. If the list contains less elements than /@nth@/, /@format@/ will be
set to GST_FORMAT_UNDEFINED.
-}
queryParseNthFormat ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@nth@/: the nth format to retrieve. -}
    -> m (Gst.Enums.Format)
queryParseNthFormat query nth = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    format <- allocMem :: IO (Ptr CUInt)
    gst_query_parse_nth_format query' nth format
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    touchManagedPtr query
    freeMem format
    return format''

#if ENABLE_OVERLOADING
data QueryParseNthFormatMethodInfo
instance (signature ~ (Word32 -> m (Gst.Enums.Format)), MonadIO m) => O.MethodInfo QueryParseNthFormatMethodInfo Query signature where
    overloadedMethod _ = queryParseNthFormat

#endif

-- method Query::parse_nth_scheduling_mode
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_SCHEDULING type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "position in the scheduling modes array to read", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "PadMode"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_nth_scheduling_mode" gst_query_parse_nth_scheduling_mode ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    IO CUInt

{- |
Parse an available query and get the scheduling mode
at /@index@/ of the scheduling modes array.
-}
queryParseNthSchedulingMode ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_SCHEDULING type query 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@index@/: position in the scheduling modes array to read -}
    -> m Gst.Enums.PadMode
    {- ^ __Returns:__ a 'GI.Gst.Enums.PadMode' of the scheduling mode at /@index@/. -}
queryParseNthSchedulingMode query index = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_query_parse_nth_scheduling_mode query' index
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data QueryParseNthSchedulingModeMethodInfo
instance (signature ~ (Word32 -> m Gst.Enums.PadMode), MonadIO m) => O.MethodInfo QueryParseNthSchedulingModeMethodInfo Query signature where
    overloadedMethod _ = queryParseNthSchedulingMode

#endif

-- method Query::parse_position
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the #GstFormat of the\n    position values (may be %NULL)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "cur", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the current position (may be %NULL)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_position" gst_query_parse_position ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- cur : TBasicType TInt64
    IO ()

{- |
Parse a position query, writing the format into /@format@/, and the position
into /@cur@/, if the respective parameters are non-'Nothing'.
-}
queryParsePosition ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m ((Gst.Enums.Format, Int64))
queryParsePosition query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    format <- allocMem :: IO (Ptr CUInt)
    cur <- allocMem :: IO (Ptr Int64)
    gst_query_parse_position query' format cur
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    cur' <- peek cur
    touchManagedPtr query
    freeMem format
    freeMem cur
    return (format'', cur')

#if ENABLE_OVERLOADING
data QueryParsePositionMethodInfo
instance (signature ~ (m ((Gst.Enums.Format, Int64))), MonadIO m) => O.MethodInfo QueryParsePositionMethodInfo Query signature where
    overloadedMethod _ = queryParsePosition

#endif

-- method Query::parse_scheduling
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstQuery of type GST_QUERY_SCHEDULING.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "SchedulingFlags"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstSchedulingFlags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "minsize", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the suggested minimum size of pull requests", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "maxsize", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the suggested maximum size of pull requests:", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "align", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the suggested alignment of pull requests", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_scheduling" gst_query_parse_scheduling ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CUInt ->                            -- flags : TInterface (Name {namespace = "Gst", name = "SchedulingFlags"})
    Ptr Int32 ->                            -- minsize : TBasicType TInt
    Ptr Int32 ->                            -- maxsize : TBasicType TInt
    Ptr Int32 ->                            -- align : TBasicType TInt
    IO ()

{- |
Set the scheduling properties.
-}
queryParseScheduling ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: A valid 'GI.Gst.Structs.Query.Query' of type GST_QUERY_SCHEDULING. -}
    -> m (([Gst.Flags.SchedulingFlags], Int32, Int32, Int32))
queryParseScheduling query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    flags <- allocMem :: IO (Ptr CUInt)
    minsize <- allocMem :: IO (Ptr Int32)
    maxsize <- allocMem :: IO (Ptr Int32)
    align <- allocMem :: IO (Ptr Int32)
    gst_query_parse_scheduling query' flags minsize maxsize align
    flags' <- peek flags
    let flags'' = wordToGFlags flags'
    minsize' <- peek minsize
    maxsize' <- peek maxsize
    align' <- peek align
    touchManagedPtr query
    freeMem flags
    freeMem minsize
    freeMem maxsize
    freeMem align
    return (flags'', minsize', maxsize', align')

#if ENABLE_OVERLOADING
data QueryParseSchedulingMethodInfo
instance (signature ~ (m (([Gst.Flags.SchedulingFlags], Int32, Int32, Int32))), MonadIO m) => O.MethodInfo QueryParseSchedulingMethodInfo Query signature where
    overloadedMethod _ = queryParseScheduling

#endif

-- method Query::parse_seeking
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_SEEKING type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the format to set for the @segment_start\n    and @segment_end values, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "seekable", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the seekable flag to set, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "segment_start", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the segment_start to set, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "segment_end", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the segment_end to set, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_seeking" gst_query_parse_seeking ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr CInt ->                             -- seekable : TBasicType TBoolean
    Ptr Int64 ->                            -- segment_start : TBasicType TInt64
    Ptr Int64 ->                            -- segment_end : TBasicType TInt64
    IO ()

{- |
Parse a seeking query, writing the format into /@format@/, and
other results into the passed parameters, if the respective parameters
are non-'Nothing'
-}
queryParseSeeking ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_SEEKING type query 'GI.Gst.Structs.Query.Query' -}
    -> m ((Gst.Enums.Format, Bool, Int64, Int64))
queryParseSeeking query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    format <- allocMem :: IO (Ptr CUInt)
    seekable <- allocMem :: IO (Ptr CInt)
    segmentStart <- allocMem :: IO (Ptr Int64)
    segmentEnd <- allocMem :: IO (Ptr Int64)
    gst_query_parse_seeking query' format seekable segmentStart segmentEnd
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    seekable' <- peek seekable
    let seekable'' = (/= 0) seekable'
    segmentStart' <- peek segmentStart
    segmentEnd' <- peek segmentEnd
    touchManagedPtr query
    freeMem format
    freeMem seekable
    freeMem segmentStart
    freeMem segmentEnd
    return (format'', seekable'', segmentStart', segmentEnd')

#if ENABLE_OVERLOADING
data QueryParseSeekingMethodInfo
instance (signature ~ (m ((Gst.Enums.Format, Bool, Int64, Int64))), MonadIO m) => O.MethodInfo QueryParseSeekingMethodInfo Query signature where
    overloadedMethod _ = queryParseSeeking

#endif

-- method Query::parse_segment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rate", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the rate of the segment, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the #GstFormat of the values,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "start_value", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the start value, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "stop_value", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the stop value, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_segment" gst_query_parse_segment ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CDouble ->                          -- rate : TBasicType TDouble
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- start_value : TBasicType TInt64
    Ptr Int64 ->                            -- stop_value : TBasicType TInt64
    IO ()

{- |
Parse a segment query answer. Any of /@rate@/, /@format@/, /@startValue@/, and
/@stopValue@/ may be 'Nothing', which will cause this value to be omitted.

See 'GI.Gst.Structs.Query.querySetSegment' for an explanation of the function arguments.
-}
queryParseSegment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m ((Double, Gst.Enums.Format, Int64, Int64))
queryParseSegment query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    rate <- allocMem :: IO (Ptr CDouble)
    format <- allocMem :: IO (Ptr CUInt)
    startValue <- allocMem :: IO (Ptr Int64)
    stopValue <- allocMem :: IO (Ptr Int64)
    gst_query_parse_segment query' rate format startValue stopValue
    rate' <- peek rate
    let rate'' = realToFrac rate'
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    startValue' <- peek startValue
    stopValue' <- peek stopValue
    touchManagedPtr query
    freeMem rate
    freeMem format
    freeMem startValue
    freeMem stopValue
    return (rate'', format'', startValue', stopValue')

#if ENABLE_OVERLOADING
data QueryParseSegmentMethodInfo
instance (signature ~ (m ((Double, Gst.Enums.Format, Int64, Int64))), MonadIO m) => O.MethodInfo QueryParseSegmentMethodInfo Query signature where
    overloadedMethod _ = queryParseSegment

#endif

-- method Query::parse_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the current URI\n    (may be %NULL)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_uri" gst_query_parse_uri ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CString ->                          -- uri : TBasicType TUTF8
    IO ()

{- |
Parse an URI query, writing the URI into /@uri@/ as a newly
allocated string, if the respective parameters are non-'Nothing'.
Free the string with 'GI.GLib.Functions.free' after usage.
-}
queryParseUri ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m (T.Text)
queryParseUri query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    uri <- allocMem :: IO (Ptr CString)
    gst_query_parse_uri query' uri
    uri' <- peek uri
    uri'' <- cstringToText uri'
    freeMem uri'
    touchManagedPtr query
    freeMem uri
    return uri''

#if ENABLE_OVERLOADING
data QueryParseUriMethodInfo
instance (signature ~ (m (T.Text)), MonadIO m) => O.MethodInfo QueryParseUriMethodInfo Query signature where
    overloadedMethod _ = queryParseUri

#endif

-- method Query::parse_uri_redirection
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the redirect URI\n    (may be %NULL)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_uri_redirection" gst_query_parse_uri_redirection ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CString ->                          -- uri : TBasicType TUTF8
    IO ()

{- |
Parse an URI query, writing the URI into /@uri@/ as a newly
allocated string, if the respective parameters are non-'Nothing'.
Free the string with 'GI.GLib.Functions.free' after usage.

/Since: 1.2/
-}
queryParseUriRedirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m (T.Text)
queryParseUriRedirection query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    uri <- allocMem :: IO (Ptr CString)
    gst_query_parse_uri_redirection query' uri
    uri' <- peek uri
    uri'' <- cstringToText uri'
    freeMem uri'
    touchManagedPtr query
    freeMem uri
    return uri''

#if ENABLE_OVERLOADING
data QueryParseUriRedirectionMethodInfo
instance (signature ~ (m (T.Text)), MonadIO m) => O.MethodInfo QueryParseUriRedirectionMethodInfo Query signature where
    overloadedMethod _ = queryParseUriRedirection

#endif

-- method Query::parse_uri_redirection_permanent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "permanent", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if the URI redirection is permanent\n    (may be %NULL)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_parse_uri_redirection_permanent" gst_query_parse_uri_redirection_permanent ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr CInt ->                             -- permanent : TBasicType TBoolean
    IO ()

{- |
Parse an URI query, and set /@permanent@/ to 'True' if there is a redirection
and it should be considered permanent. If a redirection is permanent,
applications should update their internal storage of the URI, otherwise
they should make all future requests to the original URI.

/Since: 1.4/
-}
queryParseUriRedirectionPermanent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m (Bool)
queryParseUriRedirectionPermanent query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    permanent <- allocMem :: IO (Ptr CInt)
    gst_query_parse_uri_redirection_permanent query' permanent
    permanent' <- peek permanent
    let permanent'' = (/= 0) permanent'
    touchManagedPtr query
    freeMem permanent
    return permanent''

#if ENABLE_OVERLOADING
data QueryParseUriRedirectionPermanentMethodInfo
instance (signature ~ (m (Bool)), MonadIO m) => O.MethodInfo QueryParseUriRedirectionPermanentMethodInfo Query signature where
    overloadedMethod _ = queryParseUriRedirectionPermanent

#endif

-- method Query::remove_nth_allocation_meta
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "position in the metadata API array to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_remove_nth_allocation_meta" gst_query_remove_nth_allocation_meta ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    IO ()

{- |
Remove the metadata API at /@index@/ of the metadata API array.
-}
queryRemoveNthAllocationMeta ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@index@/: position in the metadata API array to remove -}
    -> m ()
queryRemoveNthAllocationMeta query index = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    gst_query_remove_nth_allocation_meta query' index
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QueryRemoveNthAllocationMetaMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo QueryRemoveNthAllocationMetaMethodInfo Query signature where
    overloadedMethod _ = queryRemoveNthAllocationMeta

#endif

-- method Query::remove_nth_allocation_param
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "position in the allocation param array to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_remove_nth_allocation_param" gst_query_remove_nth_allocation_param ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    IO ()

{- |
Remove the allocation param at /@index@/ of the allocation param array.

/Since: 1.2/
-}
queryRemoveNthAllocationParam ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@index@/: position in the allocation param array to remove -}
    -> m ()
queryRemoveNthAllocationParam query index = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    gst_query_remove_nth_allocation_param query' index
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QueryRemoveNthAllocationParamMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo QueryRemoveNthAllocationParamMethodInfo Query signature where
    overloadedMethod _ = queryRemoveNthAllocationParam

#endif

-- method Query::remove_nth_allocation_pool
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "position in the allocation pool array to remove", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_remove_nth_allocation_pool" gst_query_remove_nth_allocation_pool ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    IO ()

{- |
Remove the allocation pool at /@index@/ of the allocation pool array.

/Since: 1.2/
-}
queryRemoveNthAllocationPool ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@index@/: position in the allocation pool array to remove -}
    -> m ()
queryRemoveNthAllocationPool query index = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    gst_query_remove_nth_allocation_pool query' index
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QueryRemoveNthAllocationPoolMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo QueryRemoveNthAllocationPoolMethodInfo Query signature where
    overloadedMethod _ = queryRemoveNthAllocationPool

#endif

-- method Query::set_accept_caps_result
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ACCEPT_CAPS type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "result", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the result 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_query_set_accept_caps_result" gst_query_set_accept_caps_result ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CInt ->                                 -- result : TBasicType TBoolean
    IO ()

{- |
Set /@result@/ as the result for the /@query@/.
-}
querySetAcceptCapsResult ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ACCEPT_CAPS type query 'GI.Gst.Structs.Query.Query' -}
    -> Bool
    {- ^ /@result@/: the result to set -}
    -> m ()
querySetAcceptCapsResult query result_ = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let result_' = (fromIntegral . fromEnum) result_
    gst_query_set_accept_caps_result query' result_'
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetAcceptCapsResultMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.MethodInfo QuerySetAcceptCapsResultMethodInfo Query signature where
    overloadedMethod _ = querySetAcceptCapsResult

#endif

-- method Query::set_bitrate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_BITRATE type #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "nominal_bitrate", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the nominal bitrate in bits per second", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_bitrate" gst_query_set_bitrate ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- nominal_bitrate : TBasicType TUInt
    IO ()

{- |
Set the results of a bitrate query.  The nominal bitrate is the average
bitrate expected over the length of the stream as advertised in file
headers (or similar).

/Since: 1.16/
-}
querySetBitrate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a GST_QUERY_BITRATE type 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@nominalBitrate@/: the nominal bitrate in bits per second -}
    -> m ()
querySetBitrate query nominalBitrate = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    gst_query_set_bitrate query' nominalBitrate
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetBitrateMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo QuerySetBitrateMethodInfo Query signature where
    overloadedMethod _ = querySetBitrate

#endif

-- method Query::set_buffering_percent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstQuery of type GST_QUERY_BUFFERING.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "busy", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if buffering is busy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "percent", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a buffering percent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_buffering_percent" gst_query_set_buffering_percent ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CInt ->                                 -- busy : TBasicType TBoolean
    Int32 ->                                -- percent : TBasicType TInt
    IO ()

{- |
Set the percentage of buffered data. This is a value between 0 and 100.
The /@busy@/ indicator is 'True' when the buffering is in progress.
-}
querySetBufferingPercent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: A valid 'GI.Gst.Structs.Query.Query' of type GST_QUERY_BUFFERING. -}
    -> Bool
    {- ^ /@busy@/: if buffering is busy -}
    -> Int32
    {- ^ /@percent@/: a buffering percent -}
    -> m ()
querySetBufferingPercent query busy percent = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let busy' = (fromIntegral . fromEnum) busy
    gst_query_set_buffering_percent query' busy' percent
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetBufferingPercentMethodInfo
instance (signature ~ (Bool -> Int32 -> m ()), MonadIO m) => O.MethodInfo QuerySetBufferingPercentMethodInfo Query signature where
    overloadedMethod _ = querySetBufferingPercent

#endif

-- method Query::set_buffering_range
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", 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 set for the @start and @stop values", 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 to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stop", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stop to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "estimated_total", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "estimated total amount of download time remaining in\n    milliseconds", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_buffering_range" gst_query_set_buffering_range ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- start : TBasicType TInt64
    Int64 ->                                -- stop : TBasicType TInt64
    Int64 ->                                -- estimated_total : TBasicType TInt64
    IO ()

{- |
Set the available query result fields in /@query@/.
-}
querySetBufferingRange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the format to set for the /@start@/ and /@stop@/ values -}
    -> Int64
    {- ^ /@start@/: the start to set -}
    -> Int64
    {- ^ /@stop@/: the stop to set -}
    -> Int64
    {- ^ /@estimatedTotal@/: estimated total amount of download time remaining in
    milliseconds -}
    -> m ()
querySetBufferingRange query format start stop estimatedTotal = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let format' = (fromIntegral . fromEnum) format
    gst_query_set_buffering_range query' format' start stop estimatedTotal
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetBufferingRangeMethodInfo
instance (signature ~ (Gst.Enums.Format -> Int64 -> Int64 -> Int64 -> m ()), MonadIO m) => O.MethodInfo QuerySetBufferingRangeMethodInfo Query signature where
    overloadedMethod _ = querySetBufferingRange

#endif

-- method Query::set_buffering_stats
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstQuery of type GST_QUERY_BUFFERING.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "BufferingMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a buffering mode", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "avg_in", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the average input rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "avg_out", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the average output rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffering_left", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "amount of buffering time left in milliseconds", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_buffering_stats" gst_query_set_buffering_stats ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- mode : TInterface (Name {namespace = "Gst", name = "BufferingMode"})
    Int32 ->                                -- avg_in : TBasicType TInt
    Int32 ->                                -- avg_out : TBasicType TInt
    Int64 ->                                -- buffering_left : TBasicType TInt64
    IO ()

{- |
Configures the buffering stats values in /@query@/.
-}
querySetBufferingStats ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: A valid 'GI.Gst.Structs.Query.Query' of type GST_QUERY_BUFFERING. -}
    -> Gst.Enums.BufferingMode
    {- ^ /@mode@/: a buffering mode -}
    -> Int32
    {- ^ /@avgIn@/: the average input rate -}
    -> Int32
    {- ^ /@avgOut@/: the average output rate -}
    -> Int64
    {- ^ /@bufferingLeft@/: amount of buffering time left in milliseconds -}
    -> m ()
querySetBufferingStats query mode avgIn avgOut bufferingLeft = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let mode' = (fromIntegral . fromEnum) mode
    gst_query_set_buffering_stats query' mode' avgIn avgOut bufferingLeft
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetBufferingStatsMethodInfo
instance (signature ~ (Gst.Enums.BufferingMode -> Int32 -> Int32 -> Int64 -> m ()), MonadIO m) => O.MethodInfo QuerySetBufferingStatsMethodInfo Query signature where
    overloadedMethod _ = querySetBufferingStats

#endif

-- method Query::set_caps_result
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The query to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to the caps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

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

{- |
Set the /@caps@/ result in /@query@/.
-}
querySetCapsResult ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: The query to use -}
    -> Gst.Caps.Caps
    {- ^ /@caps@/: A pointer to the caps -}
    -> m ()
querySetCapsResult query caps = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    caps' <- unsafeManagedPtrGetPtr caps
    gst_query_set_caps_result query' caps'
    touchManagedPtr query
    touchManagedPtr caps
    return ()

#if ENABLE_OVERLOADING
data QuerySetCapsResultMethodInfo
instance (signature ~ (Gst.Caps.Caps -> m ()), MonadIO m) => O.MethodInfo QuerySetCapsResultMethodInfo Query signature where
    overloadedMethod _ = querySetCapsResult

#endif

-- method Query::set_context
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery with query type GST_QUERY_CONTEXT", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context", argType = TInterface (Name {namespace = "Gst", name = "Context"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested #GstContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_context" gst_query_set_context ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Ptr Gst.Context.Context ->              -- context : TInterface (Name {namespace = "Gst", name = "Context"})
    IO ()

{- |
Answer a context query by setting the requested context.

/Since: 1.2/
-}
querySetContext ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' with query type GST_QUERY_CONTEXT -}
    -> Gst.Context.Context
    {- ^ /@context@/: the requested 'GI.Gst.Structs.Context.Context' -}
    -> m ()
querySetContext query context = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    context' <- unsafeManagedPtrGetPtr context
    gst_query_set_context query' context'
    touchManagedPtr query
    touchManagedPtr context
    return ()

#if ENABLE_OVERLOADING
data QuerySetContextMethodInfo
instance (signature ~ (Gst.Context.Context -> m ()), MonadIO m) => O.MethodInfo QuerySetContextMethodInfo Query signature where
    overloadedMethod _ = querySetContext

#endif

-- method Query::set_convert
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source #GstFormat", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_value", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the source value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_format", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the destination #GstFormat", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_value", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the destination 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_query_set_convert" gst_query_set_convert ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- src_format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- src_value : TBasicType TInt64
    CUInt ->                                -- dest_format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- dest_value : TBasicType TInt64
    IO ()

{- |
Answer a convert query by setting the requested values.
-}
querySetConvert ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> Gst.Enums.Format
    {- ^ /@srcFormat@/: the source 'GI.Gst.Enums.Format' -}
    -> Int64
    {- ^ /@srcValue@/: the source value -}
    -> Gst.Enums.Format
    {- ^ /@destFormat@/: the destination 'GI.Gst.Enums.Format' -}
    -> Int64
    {- ^ /@destValue@/: the destination value -}
    -> m ()
querySetConvert query srcFormat srcValue destFormat destValue = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let srcFormat' = (fromIntegral . fromEnum) srcFormat
    let destFormat' = (fromIntegral . fromEnum) destFormat
    gst_query_set_convert query' srcFormat' srcValue destFormat' destValue
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetConvertMethodInfo
instance (signature ~ (Gst.Enums.Format -> Int64 -> Gst.Enums.Format -> Int64 -> m ()), MonadIO m) => O.MethodInfo QuerySetConvertMethodInfo Query signature where
    overloadedMethod _ = querySetConvert

#endif

-- method Query::set_duration
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", 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 #GstFormat for the duration", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "duration", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the duration of the stream", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_duration" gst_query_set_duration ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- duration : TBasicType TInt64
    IO ()

{- |
Answer a duration query by setting the requested value in the given format.
-}
querySetDuration ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the 'GI.Gst.Enums.Format' for the duration -}
    -> Int64
    {- ^ /@duration@/: the duration of the stream -}
    -> m ()
querySetDuration query format duration = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let format' = (fromIntegral . fromEnum) format
    gst_query_set_duration query' format' duration
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetDurationMethodInfo
instance (signature ~ (Gst.Enums.Format -> Int64 -> m ()), MonadIO m) => O.MethodInfo QuerySetDurationMethodInfo Query signature where
    overloadedMethod _ = querySetDuration

#endif

-- method Query::set_formatsv
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_formats", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of formats to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "formats", argType = TCArray False (-1) 1 (TInterface (Name {namespace = "Gst", name = "Format"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an array containing @n_formats\n    @GstFormat values.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "n_formats", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of formats to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_formatsv" gst_query_set_formatsv ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Int32 ->                                -- n_formats : TBasicType TInt
    Ptr CUInt ->                            -- formats : TCArray False (-1) 1 (TInterface (Name {namespace = "Gst", name = "Format"}))
    IO ()

{- |
Set the formats query result fields in /@query@/. The number of formats passed
in the /@formats@/ array must be equal to /@nFormats@/.
-}
querySetFormatsv ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> [Gst.Enums.Format]
    {- ^ /@formats@/: an array containing /@nFormats@/
    /@gstFormat@/ values. -}
    -> m ()
querySetFormatsv query formats = liftIO $ do
    let nFormats = fromIntegral $ length formats
    query' <- unsafeManagedPtrGetPtr query
    let formats' = map (fromIntegral . fromEnum) formats
    formats'' <- packStorableArray formats'
    gst_query_set_formatsv query' nFormats formats''
    touchManagedPtr query
    freeMem formats''
    return ()

#if ENABLE_OVERLOADING
data QuerySetFormatsvMethodInfo
instance (signature ~ ([Gst.Enums.Format] -> m ()), MonadIO m) => O.MethodInfo QuerySetFormatsvMethodInfo Query signature where
    overloadedMethod _ = querySetFormatsv

#endif

-- method Query::set_latency
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "live", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if there is a live element upstream", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_latency", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minimal latency of the upstream elements", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_latency", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximal latency of the upstream elements", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_latency" gst_query_set_latency ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CInt ->                                 -- live : TBasicType TBoolean
    Word64 ->                               -- min_latency : TBasicType TUInt64
    Word64 ->                               -- max_latency : TBasicType TUInt64
    IO ()

{- |
Answer a latency query by setting the requested values in the given format.
-}
querySetLatency ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> Bool
    {- ^ /@live@/: if there is a live element upstream -}
    -> Word64
    {- ^ /@minLatency@/: the minimal latency of the upstream elements -}
    -> Word64
    {- ^ /@maxLatency@/: the maximal latency of the upstream elements -}
    -> m ()
querySetLatency query live minLatency maxLatency = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let live' = (fromIntegral . fromEnum) live
    gst_query_set_latency query' live' minLatency maxLatency
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetLatencyMethodInfo
instance (signature ~ (Bool -> Word64 -> Word64 -> m ()), MonadIO m) => O.MethodInfo QuerySetLatencyMethodInfo Query signature where
    overloadedMethod _ = querySetLatency

#endif

-- method Query::set_nth_allocation_param
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_QUERY_ALLOCATION type query #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "position in the allocator array to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "allocator", argType = TInterface (Name {namespace = "Gst", name = "Allocator"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "new allocator to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "params", argType = TInterface (Name {namespace = "Gst", name = "AllocationParams"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "parameters for the allocator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_nth_allocation_param" gst_query_set_nth_allocation_param ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    Ptr Gst.Allocator.Allocator ->          -- allocator : TInterface (Name {namespace = "Gst", name = "Allocator"})
    Ptr Gst.AllocationParams.AllocationParams -> -- params : TInterface (Name {namespace = "Gst", name = "AllocationParams"})
    IO ()

{- |
Parse an available query and get the allocator and its params
at /@index@/ of the allocator array.
-}
querySetNthAllocationParam ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Allocator.IsAllocator a) =>
    Query
    {- ^ /@query@/: a GST_QUERY_ALLOCATION type query 'GI.Gst.Structs.Query.Query' -}
    -> Word32
    {- ^ /@index@/: position in the allocator array to set -}
    -> Maybe (a)
    {- ^ /@allocator@/: new allocator to set -}
    -> Maybe (Gst.AllocationParams.AllocationParams)
    {- ^ /@params@/: parameters for the allocator -}
    -> m ()
querySetNthAllocationParam query index allocator params = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    maybeAllocator <- case allocator of
        Nothing -> return nullPtr
        Just jAllocator -> do
            jAllocator' <- unsafeManagedPtrCastPtr jAllocator
            return jAllocator'
    maybeParams <- case params of
        Nothing -> return nullPtr
        Just jParams -> do
            jParams' <- unsafeManagedPtrGetPtr jParams
            return jParams'
    gst_query_set_nth_allocation_param query' index maybeAllocator maybeParams
    touchManagedPtr query
    whenJust allocator touchManagedPtr
    whenJust params touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data QuerySetNthAllocationParamMethodInfo
instance (signature ~ (Word32 -> Maybe (a) -> Maybe (Gst.AllocationParams.AllocationParams) -> m ()), MonadIO m, Gst.Allocator.IsAllocator a) => O.MethodInfo QuerySetNthAllocationParamMethodInfo Query signature where
    overloadedMethod _ = querySetNthAllocationParam

#endif

-- method Query::set_nth_allocation_pool
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstQuery of type GST_QUERY_ALLOCATION.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "index to modify", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pool", argType = TInterface (Name {namespace = "Gst", name = "BufferPool"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the #GstBufferPool", 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 buffer size", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_buffers", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the min buffers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_buffers", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the max buffers", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_nth_allocation_pool" gst_query_set_nth_allocation_pool ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    Word32 ->                               -- index : TBasicType TUInt
    Ptr Gst.BufferPool.BufferPool ->        -- pool : TInterface (Name {namespace = "Gst", name = "BufferPool"})
    Word32 ->                               -- size : TBasicType TUInt
    Word32 ->                               -- min_buffers : TBasicType TUInt
    Word32 ->                               -- max_buffers : TBasicType TUInt
    IO ()

{- |
Set the pool parameters in /@query@/.
-}
querySetNthAllocationPool ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.BufferPool.IsBufferPool a) =>
    Query
    {- ^ /@query@/: A valid 'GI.Gst.Structs.Query.Query' of type GST_QUERY_ALLOCATION. -}
    -> Word32
    {- ^ /@index@/: index to modify -}
    -> Maybe (a)
    {- ^ /@pool@/: the 'GI.Gst.Objects.BufferPool.BufferPool' -}
    -> Word32
    {- ^ /@size@/: the buffer size -}
    -> Word32
    {- ^ /@minBuffers@/: the min buffers -}
    -> Word32
    {- ^ /@maxBuffers@/: the max buffers -}
    -> m ()
querySetNthAllocationPool query index pool size minBuffers maxBuffers = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    maybePool <- case pool of
        Nothing -> return nullPtr
        Just jPool -> do
            jPool' <- unsafeManagedPtrCastPtr jPool
            return jPool'
    gst_query_set_nth_allocation_pool query' index maybePool size minBuffers maxBuffers
    touchManagedPtr query
    whenJust pool touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data QuerySetNthAllocationPoolMethodInfo
instance (signature ~ (Word32 -> Maybe (a) -> Word32 -> Word32 -> Word32 -> m ()), MonadIO m, Gst.BufferPool.IsBufferPool a) => O.MethodInfo QuerySetNthAllocationPoolMethodInfo Query signature where
    overloadedMethod _ = querySetNthAllocationPool

#endif

-- method Query::set_position
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery with query type GST_QUERY_POSITION", 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 requested #GstFormat", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cur", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the position 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_query_set_position" gst_query_set_position ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- cur : TBasicType TInt64
    IO ()

{- |
Answer a position query by setting the requested value in the given format.
-}
querySetPosition ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' with query type GST_QUERY_POSITION -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the requested 'GI.Gst.Enums.Format' -}
    -> Int64
    {- ^ /@cur@/: the position to set -}
    -> m ()
querySetPosition query format cur = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let format' = (fromIntegral . fromEnum) format
    gst_query_set_position query' format' cur
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetPositionMethodInfo
instance (signature ~ (Gst.Enums.Format -> Int64 -> m ()), MonadIO m) => O.MethodInfo QuerySetPositionMethodInfo Query signature where
    overloadedMethod _ = querySetPosition

#endif

-- method Query::set_scheduling
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstQuery of type GST_QUERY_SCHEDULING.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gst", name = "SchedulingFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstSchedulingFlags", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minsize", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the suggested minimum size of pull requests", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "maxsize", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the suggested maximum size of pull requests", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "align", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the suggested alignment of pull requests", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_query_set_scheduling" gst_query_set_scheduling ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gst", name = "SchedulingFlags"})
    Int32 ->                                -- minsize : TBasicType TInt
    Int32 ->                                -- maxsize : TBasicType TInt
    Int32 ->                                -- align : TBasicType TInt
    IO ()

{- |
Set the scheduling properties.
-}
querySetScheduling ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: A valid 'GI.Gst.Structs.Query.Query' of type GST_QUERY_SCHEDULING. -}
    -> [Gst.Flags.SchedulingFlags]
    {- ^ /@flags@/: 'GI.Gst.Flags.SchedulingFlags' -}
    -> Int32
    {- ^ /@minsize@/: the suggested minimum size of pull requests -}
    -> Int32
    {- ^ /@maxsize@/: the suggested maximum size of pull requests -}
    -> Int32
    {- ^ /@align@/: the suggested alignment of pull requests -}
    -> m ()
querySetScheduling query flags minsize maxsize align = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let flags' = gflagsToWord flags
    gst_query_set_scheduling query' flags' minsize maxsize align
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetSchedulingMethodInfo
instance (signature ~ ([Gst.Flags.SchedulingFlags] -> Int32 -> Int32 -> Int32 -> m ()), MonadIO m) => O.MethodInfo QuerySetSchedulingMethodInfo Query signature where
    overloadedMethod _ = querySetScheduling

#endif

-- method Query::set_seeking
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", 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 set for the @segment_start and @segment_end values", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "seekable", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the seekable flag to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "segment_start", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the segment_start to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "segment_end", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the segment_end 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_query_set_seeking" gst_query_set_seeking ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    CInt ->                                 -- seekable : TBasicType TBoolean
    Int64 ->                                -- segment_start : TBasicType TInt64
    Int64 ->                                -- segment_end : TBasicType TInt64
    IO ()

{- |
Set the seeking query result fields in /@query@/.
-}
querySetSeeking ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the format to set for the /@segmentStart@/ and /@segmentEnd@/ values -}
    -> Bool
    {- ^ /@seekable@/: the seekable flag to set -}
    -> Int64
    {- ^ /@segmentStart@/: the segment_start to set -}
    -> Int64
    {- ^ /@segmentEnd@/: the segment_end to set -}
    -> m ()
querySetSeeking query format seekable segmentStart segmentEnd = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let format' = (fromIntegral . fromEnum) format
    let seekable' = (fromIntegral . fromEnum) seekable
    gst_query_set_seeking query' format' seekable' segmentStart segmentEnd
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetSeekingMethodInfo
instance (signature ~ (Gst.Enums.Format -> Bool -> Int64 -> Int64 -> m ()), MonadIO m) => O.MethodInfo QuerySetSeekingMethodInfo Query signature where
    overloadedMethod _ = querySetSeeking

#endif

-- method Query::set_segment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rate", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the rate of the segment", 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 #GstFormat of the segment values (@start_value and @stop_value)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start_value", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the start value", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stop_value", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stop 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_query_set_segment" gst_query_set_segment ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CDouble ->                              -- rate : TBasicType TDouble
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- start_value : TBasicType TInt64
    Int64 ->                                -- stop_value : TBasicType TInt64
    IO ()

{- |
Answer a segment query by setting the requested values. The normal
playback segment of a pipeline is 0 to duration at the default rate of
1.0. If a seek was performed on the pipeline to play a different
segment, this query will return the range specified in the last seek.

/@startValue@/ and /@stopValue@/ will respectively contain the configured
playback range start and stop values expressed in /@format@/.
The values are always between 0 and the duration of the media and
/@startValue@/ \<= /@stopValue@/. /@rate@/ will contain the playback rate. For
negative rates, playback will actually happen from /@stopValue@/ to
/@startValue@/.
-}
querySetSegment ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> Double
    {- ^ /@rate@/: the rate of the segment -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the 'GI.Gst.Enums.Format' of the segment values (/@startValue@/ and /@stopValue@/) -}
    -> Int64
    {- ^ /@startValue@/: the start value -}
    -> Int64
    {- ^ /@stopValue@/: the stop value -}
    -> m ()
querySetSegment query rate format startValue stopValue = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let rate' = realToFrac rate
    let format' = (fromIntegral . fromEnum) format
    gst_query_set_segment query' rate' format' startValue stopValue
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetSegmentMethodInfo
instance (signature ~ (Double -> Gst.Enums.Format -> Int64 -> Int64 -> m ()), MonadIO m) => O.MethodInfo QuerySetSegmentMethodInfo Query signature where
    overloadedMethod _ = querySetSegment

#endif

-- method Query::set_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery with query type GST_QUERY_URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI 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_query_set_uri" gst_query_set_uri ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CString ->                              -- uri : TBasicType TUTF8
    IO ()

{- |
Answer a URI query by setting the requested URI.
-}
querySetUri ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' with query type GST_QUERY_URI -}
    -> T.Text
    {- ^ /@uri@/: the URI to set -}
    -> m ()
querySetUri query uri = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    uri' <- textToCString uri
    gst_query_set_uri query' uri'
    touchManagedPtr query
    freeMem uri'
    return ()

#if ENABLE_OVERLOADING
data QuerySetUriMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo QuerySetUriMethodInfo Query signature where
    overloadedMethod _ = querySetUri

#endif

-- method Query::set_uri_redirection
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery with query type GST_QUERY_URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI 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_query_set_uri_redirection" gst_query_set_uri_redirection ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CString ->                              -- uri : TBasicType TUTF8
    IO ()

{- |
Answer a URI query by setting the requested URI redirection.

/Since: 1.2/
-}
querySetUriRedirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' with query type GST_QUERY_URI -}
    -> T.Text
    {- ^ /@uri@/: the URI to set -}
    -> m ()
querySetUriRedirection query uri = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    uri' <- textToCString uri
    gst_query_set_uri_redirection query' uri'
    touchManagedPtr query
    freeMem uri'
    return ()

#if ENABLE_OVERLOADING
data QuerySetUriRedirectionMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo QuerySetUriRedirectionMethodInfo Query signature where
    overloadedMethod _ = querySetUriRedirection

#endif

-- method Query::set_uri_redirection_permanent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery with query type %GST_QUERY_URI", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "permanent", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether the redirect is permanent 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_query_set_uri_redirection_permanent" gst_query_set_uri_redirection_permanent ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    CInt ->                                 -- permanent : TBasicType TBoolean
    IO ()

{- |
Answer a URI query by setting the requested URI redirection
to permanent or not.

/Since: 1.4/
-}
querySetUriRedirectionPermanent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' with query type 'GI.Gst.Enums.QueryTypeUri' -}
    -> Bool
    {- ^ /@permanent@/: whether the redirect is permanent or not -}
    -> m ()
querySetUriRedirectionPermanent query permanent = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    let permanent' = (fromIntegral . fromEnum) permanent
    gst_query_set_uri_redirection_permanent query' permanent'
    touchManagedPtr query
    return ()

#if ENABLE_OVERLOADING
data QuerySetUriRedirectionPermanentMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.MethodInfo QuerySetUriRedirectionPermanentMethodInfo Query signature where
    overloadedMethod _ = querySetUriRedirectionPermanent

#endif

-- method Query::writable_structure
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "query", argType = TInterface (Name {namespace = "Gst", name = "Query"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstQuery", 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_query_writable_structure" gst_query_writable_structure ::
    Ptr Query ->                            -- query : TInterface (Name {namespace = "Gst", name = "Query"})
    IO (Ptr Gst.Structure.Structure)

{- |
Get the structure of a query. This method should be called with a writable
/@query@/ so that the returned structure is guaranteed to be writable.
-}
queryWritableStructure ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Query
    {- ^ /@query@/: a 'GI.Gst.Structs.Query.Query' -}
    -> m Gst.Structure.Structure
    {- ^ __Returns:__ the 'GI.Gst.Structs.Structure.Structure' of the query. The structure is
    still owned by the query and will therefore be freed when the query
    is unreffed. -}
queryWritableStructure query = liftIO $ do
    query' <- unsafeManagedPtrGetPtr query
    result <- gst_query_writable_structure query'
    checkUnexpectedReturnNULL "queryWritableStructure" result
    result' <- (newBoxed Gst.Structure.Structure) result
    touchManagedPtr query
    return result'

#if ENABLE_OVERLOADING
data QueryWritableStructureMethodInfo
instance (signature ~ (m Gst.Structure.Structure), MonadIO m) => O.MethodInfo QueryWritableStructureMethodInfo Query signature where
    overloadedMethod _ = queryWritableStructure

#endif

#if ENABLE_OVERLOADING
type family ResolveQueryMethod (t :: Symbol) (o :: *) :: * where
    ResolveQueryMethod "addAllocationMeta" o = QueryAddAllocationMetaMethodInfo
    ResolveQueryMethod "addAllocationParam" o = QueryAddAllocationParamMethodInfo
    ResolveQueryMethod "addAllocationPool" o = QueryAddAllocationPoolMethodInfo
    ResolveQueryMethod "addBufferingRange" o = QueryAddBufferingRangeMethodInfo
    ResolveQueryMethod "addSchedulingMode" o = QueryAddSchedulingModeMethodInfo
    ResolveQueryMethod "findAllocationMeta" o = QueryFindAllocationMetaMethodInfo
    ResolveQueryMethod "hasSchedulingMode" o = QueryHasSchedulingModeMethodInfo
    ResolveQueryMethod "hasSchedulingModeWithFlags" o = QueryHasSchedulingModeWithFlagsMethodInfo
    ResolveQueryMethod "parseAcceptCaps" o = QueryParseAcceptCapsMethodInfo
    ResolveQueryMethod "parseAcceptCapsResult" o = QueryParseAcceptCapsResultMethodInfo
    ResolveQueryMethod "parseAllocation" o = QueryParseAllocationMethodInfo
    ResolveQueryMethod "parseBitrate" o = QueryParseBitrateMethodInfo
    ResolveQueryMethod "parseBufferingPercent" o = QueryParseBufferingPercentMethodInfo
    ResolveQueryMethod "parseBufferingRange" o = QueryParseBufferingRangeMethodInfo
    ResolveQueryMethod "parseBufferingStats" o = QueryParseBufferingStatsMethodInfo
    ResolveQueryMethod "parseCaps" o = QueryParseCapsMethodInfo
    ResolveQueryMethod "parseCapsResult" o = QueryParseCapsResultMethodInfo
    ResolveQueryMethod "parseContext" o = QueryParseContextMethodInfo
    ResolveQueryMethod "parseContextType" o = QueryParseContextTypeMethodInfo
    ResolveQueryMethod "parseConvert" o = QueryParseConvertMethodInfo
    ResolveQueryMethod "parseDuration" o = QueryParseDurationMethodInfo
    ResolveQueryMethod "parseLatency" o = QueryParseLatencyMethodInfo
    ResolveQueryMethod "parseNFormats" o = QueryParseNFormatsMethodInfo
    ResolveQueryMethod "parseNthAllocationMeta" o = QueryParseNthAllocationMetaMethodInfo
    ResolveQueryMethod "parseNthAllocationParam" o = QueryParseNthAllocationParamMethodInfo
    ResolveQueryMethod "parseNthAllocationPool" o = QueryParseNthAllocationPoolMethodInfo
    ResolveQueryMethod "parseNthBufferingRange" o = QueryParseNthBufferingRangeMethodInfo
    ResolveQueryMethod "parseNthFormat" o = QueryParseNthFormatMethodInfo
    ResolveQueryMethod "parseNthSchedulingMode" o = QueryParseNthSchedulingModeMethodInfo
    ResolveQueryMethod "parsePosition" o = QueryParsePositionMethodInfo
    ResolveQueryMethod "parseScheduling" o = QueryParseSchedulingMethodInfo
    ResolveQueryMethod "parseSeeking" o = QueryParseSeekingMethodInfo
    ResolveQueryMethod "parseSegment" o = QueryParseSegmentMethodInfo
    ResolveQueryMethod "parseUri" o = QueryParseUriMethodInfo
    ResolveQueryMethod "parseUriRedirection" o = QueryParseUriRedirectionMethodInfo
    ResolveQueryMethod "parseUriRedirectionPermanent" o = QueryParseUriRedirectionPermanentMethodInfo
    ResolveQueryMethod "removeNthAllocationMeta" o = QueryRemoveNthAllocationMetaMethodInfo
    ResolveQueryMethod "removeNthAllocationParam" o = QueryRemoveNthAllocationParamMethodInfo
    ResolveQueryMethod "removeNthAllocationPool" o = QueryRemoveNthAllocationPoolMethodInfo
    ResolveQueryMethod "writableStructure" o = QueryWritableStructureMethodInfo
    ResolveQueryMethod "getNAllocationMetas" o = QueryGetNAllocationMetasMethodInfo
    ResolveQueryMethod "getNAllocationParams" o = QueryGetNAllocationParamsMethodInfo
    ResolveQueryMethod "getNAllocationPools" o = QueryGetNAllocationPoolsMethodInfo
    ResolveQueryMethod "getNBufferingRanges" o = QueryGetNBufferingRangesMethodInfo
    ResolveQueryMethod "getNSchedulingModes" o = QueryGetNSchedulingModesMethodInfo
    ResolveQueryMethod "getStructure" o = QueryGetStructureMethodInfo
    ResolveQueryMethod "setAcceptCapsResult" o = QuerySetAcceptCapsResultMethodInfo
    ResolveQueryMethod "setBitrate" o = QuerySetBitrateMethodInfo
    ResolveQueryMethod "setBufferingPercent" o = QuerySetBufferingPercentMethodInfo
    ResolveQueryMethod "setBufferingRange" o = QuerySetBufferingRangeMethodInfo
    ResolveQueryMethod "setBufferingStats" o = QuerySetBufferingStatsMethodInfo
    ResolveQueryMethod "setCapsResult" o = QuerySetCapsResultMethodInfo
    ResolveQueryMethod "setContext" o = QuerySetContextMethodInfo
    ResolveQueryMethod "setConvert" o = QuerySetConvertMethodInfo
    ResolveQueryMethod "setDuration" o = QuerySetDurationMethodInfo
    ResolveQueryMethod "setFormatsv" o = QuerySetFormatsvMethodInfo
    ResolveQueryMethod "setLatency" o = QuerySetLatencyMethodInfo
    ResolveQueryMethod "setNthAllocationParam" o = QuerySetNthAllocationParamMethodInfo
    ResolveQueryMethod "setNthAllocationPool" o = QuerySetNthAllocationPoolMethodInfo
    ResolveQueryMethod "setPosition" o = QuerySetPositionMethodInfo
    ResolveQueryMethod "setScheduling" o = QuerySetSchedulingMethodInfo
    ResolveQueryMethod "setSeeking" o = QuerySetSeekingMethodInfo
    ResolveQueryMethod "setSegment" o = QuerySetSegmentMethodInfo
    ResolveQueryMethod "setUri" o = QuerySetUriMethodInfo
    ResolveQueryMethod "setUriRedirection" o = QuerySetUriRedirectionMethodInfo
    ResolveQueryMethod "setUriRedirectionPermanent" o = QuerySetUriRedirectionPermanentMethodInfo
    ResolveQueryMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveQueryMethod t Query, O.MethodInfo info Query p) => OL.IsLabel t (Query -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif