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

Messages are implemented as a subclass of 'GI.Gst.Structs.MiniObject.MiniObject' with a generic
'GI.Gst.Structs.Structure.Structure' as the content. This allows for writing custom messages without
requiring an API change while allowing a wide range of different types
of messages.

Messages are posted by objects in the pipeline and are passed to the
application using the 'GI.Gst.Objects.Bus.Bus'.

The basic use pattern of posting a message on a 'GI.Gst.Objects.Bus.Bus' is as follows:

=== /C code/
>
>  gst_bus_post (bus, gst_message_new_eos());


A 'GI.Gst.Objects.Element.Element' usually posts messages on the bus provided by the parent
container using 'GI.Gst.Objects.Element.elementPostMessage'.
-}

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

module GI.Gst.Structs.Message
    (

-- * Exported types
    Message(..)                             ,
    newZeroMessage                          ,
    noMessage                               ,


 -- * Methods
-- ** addRedirectEntry #method:addRedirectEntry#

#if ENABLE_OVERLOADING
    MessageAddRedirectEntryMethodInfo       ,
#endif
    messageAddRedirectEntry                 ,


-- ** getNumRedirectEntries #method:getNumRedirectEntries#

#if ENABLE_OVERLOADING
    MessageGetNumRedirectEntriesMethodInfo  ,
#endif
    messageGetNumRedirectEntries            ,


-- ** getSeqnum #method:getSeqnum#

#if ENABLE_OVERLOADING
    MessageGetSeqnumMethodInfo              ,
#endif
    messageGetSeqnum                        ,


-- ** getStreamStatusObject #method:getStreamStatusObject#

#if ENABLE_OVERLOADING
    MessageGetStreamStatusObjectMethodInfo  ,
#endif
    messageGetStreamStatusObject            ,


-- ** getStructure #method:getStructure#

#if ENABLE_OVERLOADING
    MessageGetStructureMethodInfo           ,
#endif
    messageGetStructure                     ,


-- ** hasName #method:hasName#

#if ENABLE_OVERLOADING
    MessageHasNameMethodInfo                ,
#endif
    messageHasName                          ,


-- ** newApplication #method:newApplication#

    messageNewApplication                   ,


-- ** newAsyncDone #method:newAsyncDone#

    messageNewAsyncDone                     ,


-- ** newAsyncStart #method:newAsyncStart#

    messageNewAsyncStart                    ,


-- ** newBuffering #method:newBuffering#

    messageNewBuffering                     ,


-- ** newClockLost #method:newClockLost#

    messageNewClockLost                     ,


-- ** newClockProvide #method:newClockProvide#

    messageNewClockProvide                  ,


-- ** newCustom #method:newCustom#

    messageNewCustom                        ,


-- ** newDeviceAdded #method:newDeviceAdded#

    messageNewDeviceAdded                   ,


-- ** newDeviceRemoved #method:newDeviceRemoved#

    messageNewDeviceRemoved                 ,


-- ** newDurationChanged #method:newDurationChanged#

    messageNewDurationChanged               ,


-- ** newElement #method:newElement#

    messageNewElement                       ,


-- ** newEos #method:newEos#

    messageNewEos                           ,


-- ** newError #method:newError#

    messageNewError                         ,


-- ** newErrorWithDetails #method:newErrorWithDetails#

    messageNewErrorWithDetails              ,


-- ** newHaveContext #method:newHaveContext#

    messageNewHaveContext                   ,


-- ** newInfo #method:newInfo#

    messageNewInfo                          ,


-- ** newInfoWithDetails #method:newInfoWithDetails#

    messageNewInfoWithDetails               ,


-- ** newLatency #method:newLatency#

    messageNewLatency                       ,


-- ** newNeedContext #method:newNeedContext#

    messageNewNeedContext                   ,


-- ** newNewClock #method:newNewClock#

    messageNewNewClock                      ,


-- ** newProgress #method:newProgress#

    messageNewProgress                      ,


-- ** newPropertyNotify #method:newPropertyNotify#

    messageNewPropertyNotify                ,


-- ** newQos #method:newQos#

    messageNewQos                           ,


-- ** newRedirect #method:newRedirect#

    messageNewRedirect                      ,


-- ** newRequestState #method:newRequestState#

    messageNewRequestState                  ,


-- ** newResetTime #method:newResetTime#

    messageNewResetTime                     ,


-- ** newSegmentDone #method:newSegmentDone#

    messageNewSegmentDone                   ,


-- ** newSegmentStart #method:newSegmentStart#

    messageNewSegmentStart                  ,


-- ** newStateChanged #method:newStateChanged#

    messageNewStateChanged                  ,


-- ** newStateDirty #method:newStateDirty#

    messageNewStateDirty                    ,


-- ** newStepDone #method:newStepDone#

    messageNewStepDone                      ,


-- ** newStepStart #method:newStepStart#

    messageNewStepStart                     ,


-- ** newStreamCollection #method:newStreamCollection#

    messageNewStreamCollection              ,


-- ** newStreamStart #method:newStreamStart#

    messageNewStreamStart                   ,


-- ** newStreamStatus #method:newStreamStatus#

    messageNewStreamStatus                  ,


-- ** newStreamsSelected #method:newStreamsSelected#

    messageNewStreamsSelected               ,


-- ** newStructureChange #method:newStructureChange#

    messageNewStructureChange               ,


-- ** newTag #method:newTag#

    messageNewTag                           ,


-- ** newToc #method:newToc#

    messageNewToc                           ,


-- ** newWarning #method:newWarning#

    messageNewWarning                       ,


-- ** newWarningWithDetails #method:newWarningWithDetails#

    messageNewWarningWithDetails            ,


-- ** parseAsyncDone #method:parseAsyncDone#

#if ENABLE_OVERLOADING
    MessageParseAsyncDoneMethodInfo         ,
#endif
    messageParseAsyncDone                   ,


-- ** parseBuffering #method:parseBuffering#

#if ENABLE_OVERLOADING
    MessageParseBufferingMethodInfo         ,
#endif
    messageParseBuffering                   ,


-- ** parseBufferingStats #method:parseBufferingStats#

#if ENABLE_OVERLOADING
    MessageParseBufferingStatsMethodInfo    ,
#endif
    messageParseBufferingStats              ,


-- ** parseClockLost #method:parseClockLost#

#if ENABLE_OVERLOADING
    MessageParseClockLostMethodInfo         ,
#endif
    messageParseClockLost                   ,


-- ** parseClockProvide #method:parseClockProvide#

#if ENABLE_OVERLOADING
    MessageParseClockProvideMethodInfo      ,
#endif
    messageParseClockProvide                ,


-- ** parseContextType #method:parseContextType#

#if ENABLE_OVERLOADING
    MessageParseContextTypeMethodInfo       ,
#endif
    messageParseContextType                 ,


-- ** parseDeviceAdded #method:parseDeviceAdded#

#if ENABLE_OVERLOADING
    MessageParseDeviceAddedMethodInfo       ,
#endif
    messageParseDeviceAdded                 ,


-- ** parseDeviceRemoved #method:parseDeviceRemoved#

#if ENABLE_OVERLOADING
    MessageParseDeviceRemovedMethodInfo     ,
#endif
    messageParseDeviceRemoved               ,


-- ** parseError #method:parseError#

#if ENABLE_OVERLOADING
    MessageParseErrorMethodInfo             ,
#endif
    messageParseError                       ,


-- ** parseErrorDetails #method:parseErrorDetails#

#if ENABLE_OVERLOADING
    MessageParseErrorDetailsMethodInfo      ,
#endif
    messageParseErrorDetails                ,


-- ** parseGroupId #method:parseGroupId#

#if ENABLE_OVERLOADING
    MessageParseGroupIdMethodInfo           ,
#endif
    messageParseGroupId                     ,


-- ** parseHaveContext #method:parseHaveContext#

#if ENABLE_OVERLOADING
    MessageParseHaveContextMethodInfo       ,
#endif
    messageParseHaveContext                 ,


-- ** parseInfo #method:parseInfo#

#if ENABLE_OVERLOADING
    MessageParseInfoMethodInfo              ,
#endif
    messageParseInfo                        ,


-- ** parseInfoDetails #method:parseInfoDetails#

#if ENABLE_OVERLOADING
    MessageParseInfoDetailsMethodInfo       ,
#endif
    messageParseInfoDetails                 ,


-- ** parseNewClock #method:parseNewClock#

#if ENABLE_OVERLOADING
    MessageParseNewClockMethodInfo          ,
#endif
    messageParseNewClock                    ,


-- ** parseProgress #method:parseProgress#

#if ENABLE_OVERLOADING
    MessageParseProgressMethodInfo          ,
#endif
    messageParseProgress                    ,


-- ** parsePropertyNotify #method:parsePropertyNotify#

#if ENABLE_OVERLOADING
    MessageParsePropertyNotifyMethodInfo    ,
#endif
    messageParsePropertyNotify              ,


-- ** parseQos #method:parseQos#

#if ENABLE_OVERLOADING
    MessageParseQosMethodInfo               ,
#endif
    messageParseQos                         ,


-- ** parseQosStats #method:parseQosStats#

#if ENABLE_OVERLOADING
    MessageParseQosStatsMethodInfo          ,
#endif
    messageParseQosStats                    ,


-- ** parseQosValues #method:parseQosValues#

#if ENABLE_OVERLOADING
    MessageParseQosValuesMethodInfo         ,
#endif
    messageParseQosValues                   ,


-- ** parseRedirectEntry #method:parseRedirectEntry#

#if ENABLE_OVERLOADING
    MessageParseRedirectEntryMethodInfo     ,
#endif
    messageParseRedirectEntry               ,


-- ** parseRequestState #method:parseRequestState#

#if ENABLE_OVERLOADING
    MessageParseRequestStateMethodInfo      ,
#endif
    messageParseRequestState                ,


-- ** parseResetTime #method:parseResetTime#

#if ENABLE_OVERLOADING
    MessageParseResetTimeMethodInfo         ,
#endif
    messageParseResetTime                   ,


-- ** parseSegmentDone #method:parseSegmentDone#

#if ENABLE_OVERLOADING
    MessageParseSegmentDoneMethodInfo       ,
#endif
    messageParseSegmentDone                 ,


-- ** parseSegmentStart #method:parseSegmentStart#

#if ENABLE_OVERLOADING
    MessageParseSegmentStartMethodInfo      ,
#endif
    messageParseSegmentStart                ,


-- ** parseStateChanged #method:parseStateChanged#

#if ENABLE_OVERLOADING
    MessageParseStateChangedMethodInfo      ,
#endif
    messageParseStateChanged                ,


-- ** parseStepDone #method:parseStepDone#

#if ENABLE_OVERLOADING
    MessageParseStepDoneMethodInfo          ,
#endif
    messageParseStepDone                    ,


-- ** parseStepStart #method:parseStepStart#

#if ENABLE_OVERLOADING
    MessageParseStepStartMethodInfo         ,
#endif
    messageParseStepStart                   ,


-- ** parseStreamCollection #method:parseStreamCollection#

#if ENABLE_OVERLOADING
    MessageParseStreamCollectionMethodInfo  ,
#endif
    messageParseStreamCollection            ,


-- ** parseStreamStatus #method:parseStreamStatus#

#if ENABLE_OVERLOADING
    MessageParseStreamStatusMethodInfo      ,
#endif
    messageParseStreamStatus                ,


-- ** parseStreamsSelected #method:parseStreamsSelected#

#if ENABLE_OVERLOADING
    MessageParseStreamsSelectedMethodInfo   ,
#endif
    messageParseStreamsSelected             ,


-- ** parseStructureChange #method:parseStructureChange#

#if ENABLE_OVERLOADING
    MessageParseStructureChangeMethodInfo   ,
#endif
    messageParseStructureChange             ,


-- ** parseTag #method:parseTag#

#if ENABLE_OVERLOADING
    MessageParseTagMethodInfo               ,
#endif
    messageParseTag                         ,


-- ** parseToc #method:parseToc#

#if ENABLE_OVERLOADING
    MessageParseTocMethodInfo               ,
#endif
    messageParseToc                         ,


-- ** parseWarning #method:parseWarning#

#if ENABLE_OVERLOADING
    MessageParseWarningMethodInfo           ,
#endif
    messageParseWarning                     ,


-- ** parseWarningDetails #method:parseWarningDetails#

#if ENABLE_OVERLOADING
    MessageParseWarningDetailsMethodInfo    ,
#endif
    messageParseWarningDetails              ,


-- ** setBufferingStats #method:setBufferingStats#

#if ENABLE_OVERLOADING
    MessageSetBufferingStatsMethodInfo      ,
#endif
    messageSetBufferingStats                ,


-- ** setGroupId #method:setGroupId#

#if ENABLE_OVERLOADING
    MessageSetGroupIdMethodInfo             ,
#endif
    messageSetGroupId                       ,


-- ** setQosStats #method:setQosStats#

#if ENABLE_OVERLOADING
    MessageSetQosStatsMethodInfo            ,
#endif
    messageSetQosStats                      ,


-- ** setQosValues #method:setQosValues#

#if ENABLE_OVERLOADING
    MessageSetQosValuesMethodInfo           ,
#endif
    messageSetQosValues                     ,


-- ** setSeqnum #method:setSeqnum#

#if ENABLE_OVERLOADING
    MessageSetSeqnumMethodInfo              ,
#endif
    messageSetSeqnum                        ,


-- ** setStreamStatusObject #method:setStreamStatusObject#

#if ENABLE_OVERLOADING
    MessageSetStreamStatusObjectMethodInfo  ,
#endif
    messageSetStreamStatusObject            ,


-- ** streamsSelectedAdd #method:streamsSelectedAdd#

#if ENABLE_OVERLOADING
    MessageStreamsSelectedAddMethodInfo     ,
#endif
    messageStreamsSelectedAdd               ,


-- ** streamsSelectedGetSize #method:streamsSelectedGetSize#

#if ENABLE_OVERLOADING
    MessageStreamsSelectedGetSizeMethodInfo ,
#endif
    messageStreamsSelectedGetSize           ,


-- ** streamsSelectedGetStream #method:streamsSelectedGetStream#

#if ENABLE_OVERLOADING
    MessageStreamsSelectedGetStreamMethodInfo,
#endif
    messageStreamsSelectedGetStream         ,


-- ** writableStructure #method:writableStructure#

#if ENABLE_OVERLOADING
    MessageWritableStructureMethodInfo      ,
#endif
    messageWritableStructure                ,




 -- * Properties
-- ** miniObject #attr:miniObject#
{- | the parent structure
-}
    getMessageMiniObject                    ,
#if ENABLE_OVERLOADING
    message_miniObject                      ,
#endif


-- ** seqnum #attr:seqnum#
{- | the sequence number of the message
-}
    getMessageSeqnum                        ,
#if ENABLE_OVERLOADING
    message_seqnum                          ,
#endif
    setMessageSeqnum                        ,


-- ** src #attr:src#
{- | the src of the message
-}
    clearMessageSrc                         ,
    getMessageSrc                           ,
#if ENABLE_OVERLOADING
    message_src                             ,
#endif
    setMessageSrc                           ,


-- ** timestamp #attr:timestamp#
{- | the timestamp of the message
-}
    getMessageTimestamp                     ,
#if ENABLE_OVERLOADING
    message_timestamp                       ,
#endif
    setMessageTimestamp                     ,


-- ** type #attr:type#
{- | the 'GI.Gst.Flags.MessageType' of the message
-}
    getMessageType                          ,
#if ENABLE_OVERLOADING
    message_type                            ,
#endif
    setMessageType                          ,




    ) 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.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Flags as Gst.Flags
import {-# SOURCE #-} qualified GI.Gst.Objects.Clock as Gst.Clock
import {-# SOURCE #-} qualified GI.Gst.Objects.Device as Gst.Device
import {-# SOURCE #-} qualified GI.Gst.Objects.Element as Gst.Element
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.Stream as Gst.Stream
import {-# SOURCE #-} qualified GI.Gst.Objects.StreamCollection as Gst.StreamCollection
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
import {-# SOURCE #-} qualified GI.Gst.Structs.TagList as Gst.TagList
import {-# SOURCE #-} qualified GI.Gst.Structs.Toc as Gst.Toc

-- | Memory-managed wrapper type.
newtype Message = Message (ManagedPtr Message)
foreign import ccall "gst_message_get_type" c_gst_message_get_type ::
    IO GType

instance BoxedObject Message where
    boxedType _ = c_gst_message_get_type

-- | Construct a `Message` struct initialized to zero.
newZeroMessage :: MonadIO m => m Message
newZeroMessage = liftIO $ callocBoxedBytes 120 >>= wrapBoxed Message

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


-- | A convenience alias for `Nothing` :: `Maybe` `Message`.
noMessage :: Maybe Message
noMessage = 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' message #miniObject
@
-}
getMessageMiniObject :: MonadIO m => Message -> m Gst.MiniObject.MiniObject
getMessageMiniObject 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 MessageMiniObjectFieldInfo
instance AttrInfo MessageMiniObjectFieldInfo where
    type AttrAllowedOps MessageMiniObjectFieldInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint MessageMiniObjectFieldInfo = (~) (Ptr Gst.MiniObject.MiniObject)
    type AttrBaseTypeConstraint MessageMiniObjectFieldInfo = (~) Message
    type AttrGetType MessageMiniObjectFieldInfo = Gst.MiniObject.MiniObject
    type AttrLabel MessageMiniObjectFieldInfo = "mini_object"
    type AttrOrigin MessageMiniObjectFieldInfo = Message
    attrGet _ = getMessageMiniObject
    attrSet _ = undefined
    attrConstruct = undefined
    attrClear _ = undefined

message_miniObject :: AttrLabelProxy "miniObject"
message_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' message #type
@
-}
getMessageType :: MonadIO m => Message -> m [Gst.Flags.MessageType]
getMessageType s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 64) :: IO CUInt
    let val' = wordToGFlags 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' message [ #type 'Data.GI.Base.Attributes.:=' value ]
@
-}
setMessageType :: MonadIO m => Message -> [Gst.Flags.MessageType] -> m ()
setMessageType s val = liftIO $ withManagedPtr s $ \ptr -> do
    let val' = gflagsToWord val
    poke (ptr `plusPtr` 64) (val' :: CUInt)

#if ENABLE_OVERLOADING
data MessageTypeFieldInfo
instance AttrInfo MessageTypeFieldInfo where
    type AttrAllowedOps MessageTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint MessageTypeFieldInfo = (~) [Gst.Flags.MessageType]
    type AttrBaseTypeConstraint MessageTypeFieldInfo = (~) Message
    type AttrGetType MessageTypeFieldInfo = [Gst.Flags.MessageType]
    type AttrLabel MessageTypeFieldInfo = "type"
    type AttrOrigin MessageTypeFieldInfo = Message
    attrGet _ = getMessageType
    attrSet _ = setMessageType
    attrConstruct = undefined
    attrClear _ = undefined

message_type :: AttrLabelProxy "type"
message_type = AttrLabelProxy

#endif


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

@
'Data.GI.Base.Attributes.get' message #timestamp
@
-}
getMessageTimestamp :: MonadIO m => Message -> m Word64
getMessageTimestamp s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 72) :: IO Word64
    return val

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

@
'Data.GI.Base.Attributes.set' message [ #timestamp 'Data.GI.Base.Attributes.:=' value ]
@
-}
setMessageTimestamp :: MonadIO m => Message -> Word64 -> m ()
setMessageTimestamp s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 72) (val :: Word64)

#if ENABLE_OVERLOADING
data MessageTimestampFieldInfo
instance AttrInfo MessageTimestampFieldInfo where
    type AttrAllowedOps MessageTimestampFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint MessageTimestampFieldInfo = (~) Word64
    type AttrBaseTypeConstraint MessageTimestampFieldInfo = (~) Message
    type AttrGetType MessageTimestampFieldInfo = Word64
    type AttrLabel MessageTimestampFieldInfo = "timestamp"
    type AttrOrigin MessageTimestampFieldInfo = Message
    attrGet _ = getMessageTimestamp
    attrSet _ = setMessageTimestamp
    attrConstruct = undefined
    attrClear _ = undefined

message_timestamp :: AttrLabelProxy "timestamp"
message_timestamp = AttrLabelProxy

#endif


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

@
'Data.GI.Base.Attributes.get' message #src
@
-}
getMessageSrc :: MonadIO m => Message -> m (Maybe Gst.Object.Object)
getMessageSrc s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 80) :: IO (Ptr Gst.Object.Object)
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- (newObject Gst.Object.Object) val'
        return val''
    return result

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

@
'Data.GI.Base.Attributes.set' message [ #src 'Data.GI.Base.Attributes.:=' value ]
@
-}
setMessageSrc :: MonadIO m => Message -> Ptr Gst.Object.Object -> m ()
setMessageSrc s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 80) (val :: Ptr Gst.Object.Object)

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

@
'Data.GI.Base.Attributes.clear' #src
@
-}
clearMessageSrc :: MonadIO m => Message -> m ()
clearMessageSrc s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 80) (FP.nullPtr :: Ptr Gst.Object.Object)

#if ENABLE_OVERLOADING
data MessageSrcFieldInfo
instance AttrInfo MessageSrcFieldInfo where
    type AttrAllowedOps MessageSrcFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MessageSrcFieldInfo = (~) (Ptr Gst.Object.Object)
    type AttrBaseTypeConstraint MessageSrcFieldInfo = (~) Message
    type AttrGetType MessageSrcFieldInfo = Maybe Gst.Object.Object
    type AttrLabel MessageSrcFieldInfo = "src"
    type AttrOrigin MessageSrcFieldInfo = Message
    attrGet _ = getMessageSrc
    attrSet _ = setMessageSrc
    attrConstruct = undefined
    attrClear _ = clearMessageSrc

message_src :: AttrLabelProxy "src"
message_src = AttrLabelProxy

#endif


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

@
'Data.GI.Base.Attributes.get' message #seqnum
@
-}
getMessageSeqnum :: MonadIO m => Message -> m Word32
getMessageSeqnum s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 88) :: IO Word32
    return val

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

@
'Data.GI.Base.Attributes.set' message [ #seqnum 'Data.GI.Base.Attributes.:=' value ]
@
-}
setMessageSeqnum :: MonadIO m => Message -> Word32 -> m ()
setMessageSeqnum s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 88) (val :: Word32)

#if ENABLE_OVERLOADING
data MessageSeqnumFieldInfo
instance AttrInfo MessageSeqnumFieldInfo where
    type AttrAllowedOps MessageSeqnumFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint MessageSeqnumFieldInfo = (~) Word32
    type AttrBaseTypeConstraint MessageSeqnumFieldInfo = (~) Message
    type AttrGetType MessageSeqnumFieldInfo = Word32
    type AttrLabel MessageSeqnumFieldInfo = "seqnum"
    type AttrOrigin MessageSeqnumFieldInfo = Message
    attrGet _ = getMessageSeqnum
    attrSet _ = setMessageSeqnum
    attrConstruct = undefined
    attrClear _ = undefined

message_seqnum :: AttrLabelProxy "seqnum"
message_seqnum = AttrLabelProxy

#endif



#if ENABLE_OVERLOADING
instance O.HasAttributeList Message
type instance O.AttributeList Message = MessageAttributeList
type MessageAttributeList = ('[ '("miniObject", MessageMiniObjectFieldInfo), '("type", MessageTypeFieldInfo), '("timestamp", MessageTimestampFieldInfo), '("src", MessageSrcFieldInfo), '("seqnum", MessageSeqnumFieldInfo)] :: [(Symbol, *)])
#endif

-- method Message::new_application
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the structure for the message. The message\n    will take ownership of the structure.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_application" gst_message_new_application ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Structure.Structure ->          -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Message)

{- |
Create a new application-typed message. GStreamer will never create these
messages; they are a gift from us to you. Enjoy.
-}
messageNewApplication ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: the structure for the message. The message
    will take ownership of the structure. -}
    -> m (Maybe Message)
    {- ^ __Returns:__ The new application message.

MT safe. -}
messageNewApplication src structure = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    structure' <- B.ManagedPtr.disownBoxed structure
    result <- gst_message_new_application maybeSrc structure'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Message) result'
        return result''
    whenJust src touchManagedPtr
    touchManagedPtr structure
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Message::new_async_done
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "running_time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the desired running_time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_async_done" gst_message_new_async_done ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Word64 ->                               -- running_time : TBasicType TUInt64
    IO (Ptr Message)

{- |
The message is posted when elements completed an ASYNC state change.
/@runningTime@/ contains the time of the desired running_time when this
elements goes to PLAYING. A value of 'GI.Gst.Constants.CLOCK_TIME_NONE' for /@runningTime@/
means that the element has no clock interaction and thus doesn\'t care about
the running_time of the pipeline.
-}
messageNewAsyncDone ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Word64
    {- ^ /@runningTime@/: the desired running_time -}
    -> m Message
    {- ^ __Returns:__ The new async_done message.

MT safe. -}
messageNewAsyncDone src runningTime = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    result <- gst_message_new_async_done maybeSrc runningTime
    checkUnexpectedReturnNULL "messageNewAsyncDone" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_async_start
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_async_start" gst_message_new_async_start ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Message)

{- |
This message is posted by elements when they start an ASYNC state change.
-}
messageNewAsyncStart ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> m Message
    {- ^ __Returns:__ The new async_start message.

MT safe. -}
messageNewAsyncStart src = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    result <- gst_message_new_async_start maybeSrc
    checkUnexpectedReturnNULL "messageNewAsyncStart" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_buffering
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", 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 "The buffering percent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_buffering" gst_message_new_buffering ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Int32 ->                                -- percent : TBasicType TInt
    IO (Ptr Message)

{- |
Create a new buffering message. This message can be posted by an element that
needs to buffer data before it can continue processing. /@percent@/ should be a
value between 0 and 100. A value of 100 means that the buffering completed.

When /@percent@/ is \< 100 the application should PAUSE a PLAYING pipeline. When
/@percent@/ is 100, the application can set the pipeline (back) to PLAYING.
The application must be prepared to receive BUFFERING messages in the
PREROLLING state and may only set the pipeline to PLAYING after receiving a
message with /@percent@/ set to 100, which can happen after the pipeline
completed prerolling.

MT safe.
-}
messageNewBuffering ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Int32
    {- ^ /@percent@/: The buffering percent -}
    -> m (Maybe Message)
    {- ^ __Returns:__ The new buffering message. -}
messageNewBuffering src percent = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    result <- gst_message_new_buffering maybeSrc percent
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Message) result'
        return result''
    whenJust src touchManagedPtr
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Message::new_clock_lost
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the clock that was lost", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_clock_lost" gst_message_new_clock_lost ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Clock.Clock ->                  -- clock : TInterface (Name {namespace = "Gst", name = "Clock"})
    IO (Ptr Message)

{- |
Create a clock lost message. This message is posted whenever the
clock is not valid anymore.

If this message is posted by the pipeline, the pipeline will
select a new clock again when it goes to PLAYING. It might therefore
be needed to set the pipeline to PAUSED and PLAYING again.
-}
messageNewClockLost ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Clock.IsClock b) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> b
    {- ^ /@clock@/: the clock that was lost -}
    -> m Message
    {- ^ __Returns:__ The new clock lost message.

MT safe. -}
messageNewClockLost src clock = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    clock' <- unsafeManagedPtrCastPtr clock
    result <- gst_message_new_clock_lost maybeSrc clock'
    checkUnexpectedReturnNULL "messageNewClockLost" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    touchManagedPtr clock
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_clock_provide
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the clock it provides", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ready", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE if the sender can provide a clock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_clock_provide" gst_message_new_clock_provide ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Clock.Clock ->                  -- clock : TInterface (Name {namespace = "Gst", name = "Clock"})
    CInt ->                                 -- ready : TBasicType TBoolean
    IO (Ptr Message)

{- |
Create a clock provide message. This message is posted whenever an
element is ready to provide a clock or lost its ability to provide
a clock (maybe because it paused or became EOS).

This message is mainly used internally to manage the clock
selection.
-}
messageNewClockProvide ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Clock.IsClock b) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> b
    {- ^ /@clock@/: the clock it provides -}
    -> Bool
    {- ^ /@ready@/: 'True' if the sender can provide a clock -}
    -> m Message
    {- ^ __Returns:__ the new provide clock message.

MT safe. -}
messageNewClockProvide src clock ready = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    clock' <- unsafeManagedPtrCastPtr clock
    let ready' = (fromIntegral . fromEnum) ready
    result <- gst_message_new_clock_provide maybeSrc clock' ready'
    checkUnexpectedReturnNULL "messageNewClockProvide" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    touchManagedPtr clock
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_custom
-- method type : Constructor
-- Args : [Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "MessageType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstMessageType to distinguish messages", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", 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 "the structure for the\n    message. The message will take ownership of the structure.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_custom" gst_message_new_custom ::
    CUInt ->                                -- type : TInterface (Name {namespace = "Gst", name = "MessageType"})
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Structure.Structure ->          -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Message)

{- |
Create a new custom-typed message. This can be used for anything not
handled by other message-specific functions to pass a message to the
app. The structure field can be 'Nothing'.
-}
messageNewCustom ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    [Gst.Flags.MessageType]
    {- ^ /@type@/: The 'GI.Gst.Flags.MessageType' to distinguish messages -}
    -> Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Maybe (Gst.Structure.Structure)
    {- ^ /@structure@/: the structure for the
    message. The message will take ownership of the structure. -}
    -> m (Maybe Message)
    {- ^ __Returns:__ The new message.

MT safe. -}
messageNewCustom type_ src structure = liftIO $ do
    let type_' = gflagsToWord type_
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    maybeStructure <- case structure of
        Nothing -> return nullPtr
        Just jStructure -> do
            jStructure' <- B.ManagedPtr.disownBoxed jStructure
            return jStructure'
    result <- gst_message_new_custom type_' maybeSrc maybeStructure
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Message) result'
        return result''
    whenJust src touchManagedPtr
    whenJust structure touchManagedPtr
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Message::new_device_added
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstObject that created the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The new #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_device_added" gst_message_new_device_added ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Device.Device ->                -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    IO (Ptr Message)

{- |
Creates a new device-added message. The device-added message is produced by
'GI.Gst.Objects.DeviceProvider.DeviceProvider' or a 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor'. They announce the appearance
of monitored devices.

/Since: 1.4/
-}
messageNewDeviceAdded ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Device.IsDevice b) =>
    a
    {- ^ /@src@/: The 'GI.Gst.Objects.Object.Object' that created the message -}
    -> b
    {- ^ /@device@/: The new 'GI.Gst.Objects.Device.Device' -}
    -> m Message
    {- ^ __Returns:__ a newly allocated 'GI.Gst.Structs.Message.Message' -}
messageNewDeviceAdded src device = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    device' <- unsafeManagedPtrCastPtr device
    result <- gst_message_new_device_added src' device'
    checkUnexpectedReturnNULL "messageNewDeviceAdded" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    touchManagedPtr device
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_device_removed
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstObject that created the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The removed #GstDevice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_device_removed" gst_message_new_device_removed ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Device.Device ->                -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    IO (Ptr Message)

{- |
Creates a new device-removed message. The device-removed message is produced
by 'GI.Gst.Objects.DeviceProvider.DeviceProvider' or a 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor'. They announce the
disappearance of monitored devices.

/Since: 1.4/
-}
messageNewDeviceRemoved ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Device.IsDevice b) =>
    a
    {- ^ /@src@/: The 'GI.Gst.Objects.Object.Object' that created the message -}
    -> b
    {- ^ /@device@/: The removed 'GI.Gst.Objects.Device.Device' -}
    -> m Message
    {- ^ __Returns:__ a newly allocated 'GI.Gst.Structs.Message.Message' -}
messageNewDeviceRemoved src device = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    device' <- unsafeManagedPtrCastPtr device
    result <- gst_message_new_device_removed src' device'
    checkUnexpectedReturnNULL "messageNewDeviceRemoved" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    touchManagedPtr device
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_duration_changed
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_duration_changed" gst_message_new_duration_changed ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Message)

{- |
Create a new duration changed message. This message is posted by elements
that know the duration of a stream when the duration changes. This message
is received by bins and is used to calculate the total duration of a
pipeline.
-}
messageNewDurationChanged ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> m Message
    {- ^ __Returns:__ The new duration-changed message.

MT safe. -}
messageNewDurationChanged src = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    result <- gst_message_new_duration_changed maybeSrc
    checkUnexpectedReturnNULL "messageNewDurationChanged" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_element
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The structure for the\n    message. The message will take ownership of the structure.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_element" gst_message_new_element ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Structure.Structure ->          -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Message)

{- |
Create a new element-specific message. This is meant as a generic way of
allowing one-way communication from an element to an application, for example
\"the firewire cable was unplugged\". The format of the message should be
documented in the element\'s documentation. The structure field can be 'Nothing'.
-}
messageNewElement ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Structure.Structure
    {- ^ /@structure@/: The structure for the
    message. The message will take ownership of the structure. -}
    -> m (Maybe Message)
    {- ^ __Returns:__ The new element message.

MT safe. -}
messageNewElement src structure = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    structure' <- B.ManagedPtr.disownBoxed structure
    result <- gst_message_new_element maybeSrc structure'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Message) result'
        return result''
    whenJust src touchManagedPtr
    touchManagedPtr structure
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Message::new_eos
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_eos" gst_message_new_eos ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Message)

{- |
Create a new eos message. This message is generated and posted in
the sink elements of a GstBin. The bin will only forward the EOS
message to the application if all sinks have posted an EOS message.
-}
messageNewEos ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> m Message
    {- ^ __Returns:__ The new eos message.

MT safe. -}
messageNewEos src = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    result <- gst_message_new_eos maybeSrc
    checkUnexpectedReturnNULL "messageNewEos" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_error
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The GError for this message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A debugging string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_error" gst_message_new_error ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr GError ->                           -- error : TError
    CString ->                              -- debug : TBasicType TUTF8
    IO (Ptr Message)

{- |
Create a new error message. The message will copy /@error@/ and
/@debug@/. This message is posted by element when a fatal event
occurred. The pipeline will probably (partially) stop. The application
receiving this message should stop the pipeline.
-}
messageNewError ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> GError
    {- ^ /@error@/: The GError for this message. -}
    -> T.Text
    {- ^ /@debug@/: A debugging string. -}
    -> m Message
    {- ^ __Returns:__ the new error message.

MT safe. -}
messageNewError src error_ debug = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    error_' <- unsafeManagedPtrGetPtr error_
    debug' <- textToCString debug
    result <- gst_message_new_error maybeSrc error_' debug'
    checkUnexpectedReturnNULL "messageNewError" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    touchManagedPtr error_
    freeMem debug'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_error_with_details
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The GError for this message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A debugging string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "details", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "(allow-none): A GstStructure with details", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_error_with_details" gst_message_new_error_with_details ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr GError ->                           -- error : TError
    CString ->                              -- debug : TBasicType TUTF8
    Ptr Gst.Structure.Structure ->          -- details : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Message)

{- |
Create a new error message. The message will copy /@error@/ and
/@debug@/. This message is posted by element when a fatal event
occurred. The pipeline will probably (partially) stop. The application
receiving this message should stop the pipeline.

/Since: 1.10/
-}
messageNewErrorWithDetails ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> GError
    {- ^ /@error@/: The GError for this message. -}
    -> T.Text
    {- ^ /@debug@/: A debugging string. -}
    -> Gst.Structure.Structure
    {- ^ /@details@/: (allow-none): A GstStructure with details -}
    -> m (Maybe Message)
    {- ^ __Returns:__ the new error message. -}
messageNewErrorWithDetails src error_ debug details = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    error_' <- unsafeManagedPtrGetPtr error_
    debug' <- textToCString debug
    details' <- B.ManagedPtr.disownBoxed details
    result <- gst_message_new_error_with_details maybeSrc error_' debug' details'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Message) result'
        return result''
    whenJust src touchManagedPtr
    touchManagedPtr error_
    touchManagedPtr details
    freeMem debug'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Message::new_have_context
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", 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 context", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_have_context" gst_message_new_have_context ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Context.Context ->              -- context : TInterface (Name {namespace = "Gst", name = "Context"})
    IO (Ptr Message)

{- |
This message is posted when an element has a new local 'GI.Gst.Structs.Context.Context'.

/Since: 1.2/
-}
messageNewHaveContext ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Context.Context
    {- ^ /@context@/: the context -}
    -> m Message
    {- ^ __Returns:__ The new have-context message.

MT safe. -}
messageNewHaveContext src context = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    context' <- B.ManagedPtr.disownBoxed context
    result <- gst_message_new_have_context maybeSrc context'
    checkUnexpectedReturnNULL "messageNewHaveContext" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    touchManagedPtr context
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_info
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The GError for this message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A debugging string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_info" gst_message_new_info ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr GError ->                           -- error : TError
    CString ->                              -- debug : TBasicType TUTF8
    IO (Ptr Message)

{- |
Create a new info message. The message will make copies of /@error@/ and
/@debug@/.
-}
messageNewInfo ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> GError
    {- ^ /@error@/: The GError for this message. -}
    -> T.Text
    {- ^ /@debug@/: A debugging string. -}
    -> m Message
    {- ^ __Returns:__ the new info message.

MT safe. -}
messageNewInfo src error_ debug = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    error_' <- unsafeManagedPtrGetPtr error_
    debug' <- textToCString debug
    result <- gst_message_new_info maybeSrc error_' debug'
    checkUnexpectedReturnNULL "messageNewInfo" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    touchManagedPtr error_
    freeMem debug'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_info_with_details
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The GError for this message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A debugging string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "details", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "(allow-none): A GstStructure with details", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_info_with_details" gst_message_new_info_with_details ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr GError ->                           -- error : TError
    CString ->                              -- debug : TBasicType TUTF8
    Ptr Gst.Structure.Structure ->          -- details : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Message)

{- |
Create a new info message. The message will make copies of /@error@/ and
/@debug@/.

/Since: 1.10/
-}
messageNewInfoWithDetails ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> GError
    {- ^ /@error@/: The GError for this message. -}
    -> T.Text
    {- ^ /@debug@/: A debugging string. -}
    -> Gst.Structure.Structure
    {- ^ /@details@/: (allow-none): A GstStructure with details -}
    -> m (Maybe Message)
    {- ^ __Returns:__ the new warning message. -}
messageNewInfoWithDetails src error_ debug details = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    error_' <- unsafeManagedPtrGetPtr error_
    debug' <- textToCString debug
    details' <- B.ManagedPtr.disownBoxed details
    result <- gst_message_new_info_with_details maybeSrc error_' debug' details'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Message) result'
        return result''
    whenJust src touchManagedPtr
    touchManagedPtr error_
    touchManagedPtr details
    freeMem debug'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Message::new_latency
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_latency" gst_message_new_latency ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Message)

{- |
This message can be posted by elements when their latency requirements have
changed.
-}
messageNewLatency ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> m Message
    {- ^ __Returns:__ The new latency message.

MT safe. -}
messageNewLatency src = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    result <- gst_message_new_latency maybeSrc
    checkUnexpectedReturnNULL "messageNewLatency" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_need_context
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "context_type", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The context type that is needed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_need_context" gst_message_new_need_context ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CString ->                              -- context_type : TBasicType TUTF8
    IO (Ptr Message)

{- |
This message is posted when an element needs a specific 'GI.Gst.Structs.Context.Context'.

/Since: 1.2/
-}
messageNewNeedContext ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> T.Text
    {- ^ /@contextType@/: The context type that is needed -}
    -> m Message
    {- ^ __Returns:__ The new need-context message.

MT safe. -}
messageNewNeedContext src contextType = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    contextType' <- textToCString contextType
    result <- gst_message_new_need_context maybeSrc contextType'
    checkUnexpectedReturnNULL "messageNewNeedContext" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    freeMem contextType'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_new_clock
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new selected clock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_new_clock" gst_message_new_new_clock ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Clock.Clock ->                  -- clock : TInterface (Name {namespace = "Gst", name = "Clock"})
    IO (Ptr Message)

{- |
Create a new clock message. This message is posted whenever the
pipeline selects a new clock for the pipeline.
-}
messageNewNewClock ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Clock.IsClock b) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> b
    {- ^ /@clock@/: the new selected clock -}
    -> m Message
    {- ^ __Returns:__ The new new clock message.

MT safe. -}
messageNewNewClock src clock = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    clock' <- unsafeManagedPtrCastPtr clock
    result <- gst_message_new_new_clock maybeSrc clock'
    checkUnexpectedReturnNULL "messageNewNewClock" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    touchManagedPtr clock
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_progress
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "ProgressType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstProgressType", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "code", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a progress code", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "free, user visible text describing the progress", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_progress" gst_message_new_progress ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CUInt ->                                -- type : TInterface (Name {namespace = "Gst", name = "ProgressType"})
    CString ->                              -- code : TBasicType TUTF8
    CString ->                              -- text : TBasicType TUTF8
    IO (Ptr Message)

{- |
Progress messages are posted by elements when they use an asynchronous task
to perform actions triggered by a state change.

/@code@/ contains a well defined string describing the action.
/@text@/ should contain a user visible string detailing the current action.
-}
messageNewProgress ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Enums.ProgressType
    {- ^ /@type@/: a 'GI.Gst.Enums.ProgressType' -}
    -> T.Text
    {- ^ /@code@/: a progress code -}
    -> T.Text
    {- ^ /@text@/: free, user visible text describing the progress -}
    -> m (Maybe Message)
    {- ^ __Returns:__ The new qos message. -}
messageNewProgress src type_ code text = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    let type_' = (fromIntegral . fromEnum) type_
    code' <- textToCString code
    text' <- textToCString text
    result <- gst_message_new_progress src' type_' code' text'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Message) result'
        return result''
    touchManagedPtr src
    freeMem code'
    freeMem text'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Message::new_property_notify
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstObject whose property changed (may or may not be a #GstElement)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name of the property that changed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "val", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "new property value, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_property_notify" gst_message_new_property_notify ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CString ->                              -- property_name : TBasicType TUTF8
    Ptr GValue ->                           -- val : TInterface (Name {namespace = "GObject", name = "Value"})
    IO (Ptr Message)

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

/Since: 1.10/
-}
messageNewPropertyNotify ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: The 'GI.Gst.Objects.Object.Object' whose property changed (may or may not be a 'GI.Gst.Objects.Element.Element') -}
    -> T.Text
    {- ^ /@propertyName@/: name of the property that changed -}
    -> Maybe (GValue)
    {- ^ /@val@/: new property value, or 'Nothing' -}
    -> m Message
    {- ^ __Returns:__ a newly allocated 'GI.Gst.Structs.Message.Message' -}
messageNewPropertyNotify src propertyName val = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    propertyName' <- textToCString propertyName
    maybeVal <- case val of
        Nothing -> return nullPtr
        Just jVal -> do
            jVal' <- B.ManagedPtr.disownBoxed jVal
            return jVal'
    result <- gst_message_new_property_notify src' propertyName' maybeVal
    checkUnexpectedReturnNULL "messageNewPropertyNotify" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    whenJust val touchManagedPtr
    freeMem propertyName'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_qos
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The object originating the message.", 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 the message was generated by a live element", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "running_time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the running time of the buffer that generated the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stream_time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stream time of the buffer that generated the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the timestamps of the buffer that generated the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "duration", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the duration of the buffer that generated the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_qos" gst_message_new_qos ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CInt ->                                 -- live : TBasicType TBoolean
    Word64 ->                               -- running_time : TBasicType TUInt64
    Word64 ->                               -- stream_time : TBasicType TUInt64
    Word64 ->                               -- timestamp : TBasicType TUInt64
    Word64 ->                               -- duration : TBasicType TUInt64
    IO (Ptr Message)

{- |
A QOS message is posted on the bus whenever an element decides to drop a
buffer because of QoS reasons or whenever it changes its processing strategy
because of QoS reasons (quality adjustments such as processing at lower
accuracy).

This message can be posted by an element that performs synchronisation against the
clock (live) or it could be dropped by an element that performs QoS because of QOS
events received from a downstream element (!live).

/@runningTime@/, /@streamTime@/, /@timestamp@/, /@duration@/ should be set to the
respective running-time, stream-time, timestamp and duration of the (dropped)
buffer that generated the QoS event. Values can be left to
GST_CLOCK_TIME_NONE when unknown.
-}
messageNewQos ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: The object originating the message. -}
    -> Bool
    {- ^ /@live@/: if the message was generated by a live element -}
    -> Word64
    {- ^ /@runningTime@/: the running time of the buffer that generated the message -}
    -> Word64
    {- ^ /@streamTime@/: the stream time of the buffer that generated the message -}
    -> Word64
    {- ^ /@timestamp@/: the timestamps of the buffer that generated the message -}
    -> Word64
    {- ^ /@duration@/: the duration of the buffer that generated the message -}
    -> m Message
    {- ^ __Returns:__ The new qos message.

MT safe. -}
messageNewQos src live runningTime streamTime timestamp duration = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    let live' = (fromIntegral . fromEnum) live
    result <- gst_message_new_qos src' live' runningTime streamTime timestamp duration
    checkUnexpectedReturnNULL "messageNewQos" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_redirect
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstObject whose property changed (may or may not be a #GstElement)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "location", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location string for the new entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tag_list", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "tag list for the new entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "entry_struct", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "structure for the new entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_redirect" gst_message_new_redirect ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CString ->                              -- location : TBasicType TUTF8
    Ptr Gst.TagList.TagList ->              -- tag_list : TInterface (Name {namespace = "Gst", name = "TagList"})
    Ptr Gst.Structure.Structure ->          -- entry_struct : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Message)

{- |
Creates a new redirect message and adds a new entry to it. Redirect messages
are posted when an element detects that the actual data has to be retrieved
from a different location. This is useful if such a redirection cannot be
handled inside a source element, for example when HTTP 302\/303 redirects
return a non-HTTP URL.

The redirect message can hold multiple entries. The first one is added
when the redirect message is created, with the given location, tag_list,
entry_struct arguments. Use 'GI.Gst.Structs.Message.messageAddRedirectEntry' to add more
entries.

Each entry has a location, a tag list, and a structure. All of these are
optional. The tag list and structure are useful for additional metadata,
such as bitrate statistics for the given location.

By default, message recipients should treat entries in the order they are
stored. The recipient should therefore try entry @/0/@ first, and if this
entry is not acceptable or working, try entry @/1/@ etc. Senders must make
sure that they add entries in this order. However, recipients are free to
ignore the order and pick an entry that is \"best\" for them. One example
would be a recipient that scans the entries for the one with the highest
bitrate tag.

The specified location string is copied. However, ownership over the tag
list and structure are transferred to the message.

/Since: 1.10/
-}
messageNewRedirect ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: The 'GI.Gst.Objects.Object.Object' whose property changed (may or may not be a 'GI.Gst.Objects.Element.Element') -}
    -> T.Text
    {- ^ /@location@/: location string for the new entry -}
    -> Maybe (Gst.TagList.TagList)
    {- ^ /@tagList@/: tag list for the new entry -}
    -> Maybe (Gst.Structure.Structure)
    {- ^ /@entryStruct@/: structure for the new entry -}
    -> m Message
    {- ^ __Returns:__ a newly allocated 'GI.Gst.Structs.Message.Message' -}
messageNewRedirect src location tagList entryStruct = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    location' <- textToCString location
    maybeTagList <- case tagList of
        Nothing -> return nullPtr
        Just jTagList -> do
            jTagList' <- B.ManagedPtr.disownBoxed jTagList
            return jTagList'
    maybeEntryStruct <- case entryStruct of
        Nothing -> return nullPtr
        Just jEntryStruct -> do
            jEntryStruct' <- B.ManagedPtr.disownBoxed jEntryStruct
            return jEntryStruct'
    result <- gst_message_new_redirect src' location' maybeTagList maybeEntryStruct
    checkUnexpectedReturnNULL "messageNewRedirect" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    whenJust tagList touchManagedPtr
    whenJust entryStruct touchManagedPtr
    freeMem location'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_request_state
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "state", argType = TInterface (Name {namespace = "Gst", name = "State"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The new requested state", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_request_state" gst_message_new_request_state ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CUInt ->                                -- state : TInterface (Name {namespace = "Gst", name = "State"})
    IO (Ptr Message)

{- |
This message can be posted by elements when they want to have their state
changed. A typical use case would be an audio server that wants to pause the
pipeline because a higher priority stream is being played.
-}
messageNewRequestState ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Enums.State
    {- ^ /@state@/: The new requested state -}
    -> m Message
    {- ^ __Returns:__ the new request state message.

MT safe. -}
messageNewRequestState src state = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    let state' = (fromIntegral . fromEnum) state
    result <- gst_message_new_request_state maybeSrc state'
    checkUnexpectedReturnNULL "messageNewRequestState" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_reset_time
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "running_time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested running-time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_reset_time" gst_message_new_reset_time ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Word64 ->                               -- running_time : TBasicType TUInt64
    IO (Ptr Message)

{- |
This message is posted when the pipeline running-time should be reset to
/@runningTime@/, like after a flushing seek.
-}
messageNewResetTime ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Word64
    {- ^ /@runningTime@/: the requested running-time -}
    -> m Message
    {- ^ __Returns:__ The new reset_time message.

MT safe. -}
messageNewResetTime src runningTime = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    result <- gst_message_new_reset_time maybeSrc runningTime
    checkUnexpectedReturnNULL "messageNewResetTime" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_segment_done
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", 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 of the position being done", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "position", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The position of the segment being done", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_segment_done" gst_message_new_segment_done ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- position : TBasicType TInt64
    IO (Ptr Message)

{- |
Create a new segment done message. This message is posted by elements that
finish playback of a segment as a result of a segment seek. This message
is received by the application after all elements that posted a segment_start
have posted the segment_done.
-}
messageNewSegmentDone ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Enums.Format
    {- ^ /@format@/: The format of the position being done -}
    -> Int64
    {- ^ /@position@/: The position of the segment being done -}
    -> m Message
    {- ^ __Returns:__ the new segment done message.

MT safe. -}
messageNewSegmentDone src format position = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    let format' = (fromIntegral . fromEnum) format
    result <- gst_message_new_segment_done maybeSrc format' position
    checkUnexpectedReturnNULL "messageNewSegmentDone" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_segment_start
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", 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 of the position being played", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "position", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The position of the segment being played", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_segment_start" gst_message_new_segment_start ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Int64 ->                                -- position : TBasicType TInt64
    IO (Ptr Message)

{- |
Create a new segment message. This message is posted by elements that
start playback of a segment as a result of a segment seek. This message
is not received by the application but is used for maintenance reasons in
container elements.
-}
messageNewSegmentStart ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Enums.Format
    {- ^ /@format@/: The format of the position being played -}
    -> Int64
    {- ^ /@position@/: The position of the segment being played -}
    -> m Message
    {- ^ __Returns:__ the new segment start message.

MT safe. -}
messageNewSegmentStart src format position = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    let format' = (fromIntegral . fromEnum) format
    result <- gst_message_new_segment_start maybeSrc format' position
    checkUnexpectedReturnNULL "messageNewSegmentStart" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_state_changed
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "oldstate", argType = TInterface (Name {namespace = "Gst", name = "State"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the previous state", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "newstate", argType = TInterface (Name {namespace = "Gst", name = "State"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new (current) state", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pending", argType = TInterface (Name {namespace = "Gst", name = "State"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the pending (target) state", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_state_changed" gst_message_new_state_changed ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CUInt ->                                -- oldstate : TInterface (Name {namespace = "Gst", name = "State"})
    CUInt ->                                -- newstate : TInterface (Name {namespace = "Gst", name = "State"})
    CUInt ->                                -- pending : TInterface (Name {namespace = "Gst", name = "State"})
    IO (Ptr Message)

{- |
Create a state change message. This message is posted whenever an element
changed its state.
-}
messageNewStateChanged ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Enums.State
    {- ^ /@oldstate@/: the previous state -}
    -> Gst.Enums.State
    {- ^ /@newstate@/: the new (current) state -}
    -> Gst.Enums.State
    {- ^ /@pending@/: the pending (target) state -}
    -> m Message
    {- ^ __Returns:__ the new state change message.

MT safe. -}
messageNewStateChanged src oldstate newstate pending = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    let oldstate' = (fromIntegral . fromEnum) oldstate
    let newstate' = (fromIntegral . fromEnum) newstate
    let pending' = (fromIntegral . fromEnum) pending
    result <- gst_message_new_state_changed maybeSrc oldstate' newstate' pending'
    checkUnexpectedReturnNULL "messageNewStateChanged" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_state_dirty
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_state_dirty" gst_message_new_state_dirty ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Message)

{- |
Create a state dirty message. This message is posted whenever an element
changed its state asynchronously and is used internally to update the
states of container objects.
-}
messageNewStateDirty ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message -}
    -> m Message
    {- ^ __Returns:__ the new state dirty message.

MT safe. -}
messageNewStateDirty src = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    result <- gst_message_new_state_dirty maybeSrc
    checkUnexpectedReturnNULL "messageNewStateDirty" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_step_done
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The object originating the message.", 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 of @amount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "amount", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the amount of stepped data", 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 stepped amount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flush", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "is this an flushing step", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "intermediate", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "is this an intermediate step", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "duration", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the duration of the data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "eos", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the step caused EOS", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_step_done" gst_message_new_step_done ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Word64 ->                               -- amount : TBasicType TUInt64
    CDouble ->                              -- rate : TBasicType TDouble
    CInt ->                                 -- flush : TBasicType TBoolean
    CInt ->                                 -- intermediate : TBasicType TBoolean
    Word64 ->                               -- duration : TBasicType TUInt64
    CInt ->                                 -- eos : TBasicType TBoolean
    IO (Ptr Message)

{- |
This message is posted by elements when they complete a part, when /@intermediate@/ set
to 'True', or a complete step operation.

/@duration@/ will contain the amount of time (in GST_FORMAT_TIME) of the stepped
/@amount@/ of media in format /@format@/.
-}
messageNewStepDone ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the format of /@amount@/ -}
    -> Word64
    {- ^ /@amount@/: the amount of stepped data -}
    -> Double
    {- ^ /@rate@/: the rate of the stepped amount -}
    -> Bool
    {- ^ /@flush@/: is this an flushing step -}
    -> Bool
    {- ^ /@intermediate@/: is this an intermediate step -}
    -> Word64
    {- ^ /@duration@/: the duration of the data -}
    -> Bool
    {- ^ /@eos@/: the step caused EOS -}
    -> m Message
    {- ^ __Returns:__ the new step_done message.

MT safe. -}
messageNewStepDone src format amount rate flush intermediate duration eos = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    let format' = (fromIntegral . fromEnum) format
    let rate' = realToFrac rate
    let flush' = (fromIntegral . fromEnum) flush
    let intermediate' = (fromIntegral . fromEnum) intermediate
    let eos' = (fromIntegral . fromEnum) eos
    result <- gst_message_new_step_done src' format' amount rate' flush' intermediate' duration eos'
    checkUnexpectedReturnNULL "messageNewStepDone" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_step_start
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if the step is active or queued", 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 of @amount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "amount", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the amount of stepped data", 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 stepped amount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flush", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "is this an flushing step", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "intermediate", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "is this an intermediate step", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_step_start" gst_message_new_step_start ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CInt ->                                 -- active : TBasicType TBoolean
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Word64 ->                               -- amount : TBasicType TUInt64
    CDouble ->                              -- rate : TBasicType TDouble
    CInt ->                                 -- flush : TBasicType TBoolean
    CInt ->                                 -- intermediate : TBasicType TBoolean
    IO (Ptr Message)

{- |
This message is posted by elements when they accept or activate a new step
event for /@amount@/ in /@format@/.

/@active@/ is set to 'False' when the element accepted the new step event and has
queued it for execution in the streaming threads.

/@active@/ is set to 'True' when the element has activated the step operation and
is now ready to start executing the step in the streaming thread. After this
message is emitted, the application can queue a new step operation in the
element.
-}
messageNewStepStart ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: The object originating the message. -}
    -> Bool
    {- ^ /@active@/: if the step is active or queued -}
    -> Gst.Enums.Format
    {- ^ /@format@/: the format of /@amount@/ -}
    -> Word64
    {- ^ /@amount@/: the amount of stepped data -}
    -> Double
    {- ^ /@rate@/: the rate of the stepped amount -}
    -> Bool
    {- ^ /@flush@/: is this an flushing step -}
    -> Bool
    {- ^ /@intermediate@/: is this an intermediate step -}
    -> m Message
    {- ^ __Returns:__ The new step_start message.

MT safe. -}
messageNewStepStart src active format amount rate flush intermediate = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    let active' = (fromIntegral . fromEnum) active
    let format' = (fromIntegral . fromEnum) format
    let rate' = realToFrac rate
    let flush' = (fromIntegral . fromEnum) flush
    let intermediate' = (fromIntegral . fromEnum) intermediate
    result <- gst_message_new_step_start src' active' format' amount rate' flush' intermediate'
    checkUnexpectedReturnNULL "messageNewStepStart" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_stream_collection
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstObject that created the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "collection", argType = TInterface (Name {namespace = "Gst", name = "StreamCollection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstStreamCollection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_stream_collection" gst_message_new_stream_collection ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.StreamCollection.StreamCollection -> -- collection : TInterface (Name {namespace = "Gst", name = "StreamCollection"})
    IO (Ptr Message)

{- |
Creates a new stream-collection message. The message is used to announce new
'GI.Gst.Objects.StreamCollection.StreamCollection'

/Since: 1.10/
-}
messageNewStreamCollection ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.StreamCollection.IsStreamCollection b) =>
    a
    {- ^ /@src@/: The 'GI.Gst.Objects.Object.Object' that created the message -}
    -> b
    {- ^ /@collection@/: The 'GI.Gst.Objects.StreamCollection.StreamCollection' -}
    -> m Message
    {- ^ __Returns:__ a newly allocated 'GI.Gst.Structs.Message.Message' -}
messageNewStreamCollection src collection = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    collection' <- unsafeManagedPtrCastPtr collection
    result <- gst_message_new_stream_collection src' collection'
    checkUnexpectedReturnNULL "messageNewStreamCollection" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    touchManagedPtr collection
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_stream_start
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_stream_start" gst_message_new_stream_start ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    IO (Ptr Message)

{- |
Create a new stream_start message. This message is generated and posted in
the sink elements of a GstBin. The bin will only forward the STREAM_START
message to the application if all sinks have posted an STREAM_START message.
-}
messageNewStreamStart ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> m Message
    {- ^ __Returns:__ The new stream_start message.

MT safe. -}
messageNewStreamStart src = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    result <- gst_message_new_stream_start maybeSrc
    checkUnexpectedReturnNULL "messageNewStreamStart" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_stream_status
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "StreamStatusType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The stream status type.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "owner", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the owner element of @src.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_stream_status" gst_message_new_stream_status ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CUInt ->                                -- type : TInterface (Name {namespace = "Gst", name = "StreamStatusType"})
    Ptr Gst.Element.Element ->              -- owner : TInterface (Name {namespace = "Gst", name = "Element"})
    IO (Ptr Message)

{- |
Create a new stream status message. This message is posted when a streaming
thread is created\/destroyed or when the state changed.
-}
messageNewStreamStatus ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Element.IsElement b) =>
    a
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Enums.StreamStatusType
    {- ^ /@type@/: The stream status type. -}
    -> b
    {- ^ /@owner@/: the owner element of /@src@/. -}
    -> m Message
    {- ^ __Returns:__ the new stream status message.

MT safe. -}
messageNewStreamStatus src type_ owner = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    let type_' = (fromIntegral . fromEnum) type_
    owner' <- unsafeManagedPtrCastPtr owner
    result <- gst_message_new_stream_status src' type_' owner'
    checkUnexpectedReturnNULL "messageNewStreamStatus" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    touchManagedPtr owner
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_streams_selected
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstObject that created the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "collection", argType = TInterface (Name {namespace = "Gst", name = "StreamCollection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstStreamCollection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_streams_selected" gst_message_new_streams_selected ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.StreamCollection.StreamCollection -> -- collection : TInterface (Name {namespace = "Gst", name = "StreamCollection"})
    IO (Ptr Message)

{- |
Creates a new steams-selected message. The message is used to announce
that an array of streams has been selected. This is generally in response
to a @/GST_EVENT_SELECT_STREAMS/@ event, or when an element (such as decodebin3)
makes an initial selection of streams.

The message also contains the 'GI.Gst.Objects.StreamCollection.StreamCollection' to which the various streams
belong to.

Users of 'GI.Gst.Structs.Message.messageNewStreamsSelected' can add the selected streams with
'GI.Gst.Structs.Message.messageStreamsSelectedAdd'.

/Since: 1.10/
-}
messageNewStreamsSelected ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.StreamCollection.IsStreamCollection b) =>
    a
    {- ^ /@src@/: The 'GI.Gst.Objects.Object.Object' that created the message -}
    -> b
    {- ^ /@collection@/: The 'GI.Gst.Objects.StreamCollection.StreamCollection' -}
    -> m Message
    {- ^ __Returns:__ a newly allocated 'GI.Gst.Structs.Message.Message' -}
messageNewStreamsSelected src collection = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    collection' <- unsafeManagedPtrCastPtr collection
    result <- gst_message_new_streams_selected src' collection'
    checkUnexpectedReturnNULL "messageNewStreamsSelected" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    touchManagedPtr collection
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_structure_change
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "StructureChangeType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The change type.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "owner", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The owner element of @src.", 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 "Whether the structure change is busy.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_structure_change" gst_message_new_structure_change ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    CUInt ->                                -- type : TInterface (Name {namespace = "Gst", name = "StructureChangeType"})
    Ptr Gst.Element.Element ->              -- owner : TInterface (Name {namespace = "Gst", name = "Element"})
    CInt ->                                 -- busy : TBasicType TBoolean
    IO (Ptr Message)

{- |
Create a new structure change message. This message is posted when the
structure of a pipeline is in the process of being changed, for example
when pads are linked or unlinked.

/@src@/ should be the sinkpad that unlinked or linked.
-}
messageNewStructureChange ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a, Gst.Element.IsElement b) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.Enums.StructureChangeType
    {- ^ /@type@/: The change type. -}
    -> b
    {- ^ /@owner@/: The owner element of /@src@/. -}
    -> Bool
    {- ^ /@busy@/: Whether the structure change is busy. -}
    -> m Message
    {- ^ __Returns:__ the new structure change message.

MT safe. -}
messageNewStructureChange src type_ owner busy = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    let type_' = (fromIntegral . fromEnum) type_
    owner' <- unsafeManagedPtrCastPtr owner
    let busy' = (fromIntegral . fromEnum) busy
    result <- gst_message_new_structure_change maybeSrc type_' owner' busy'
    checkUnexpectedReturnNULL "messageNewStructureChange" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    touchManagedPtr owner
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_tag
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tag_list", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the tag list for the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_tag" gst_message_new_tag ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.TagList.TagList ->              -- tag_list : TInterface (Name {namespace = "Gst", name = "TagList"})
    IO (Ptr Message)

{- |
Create a new tag message. The message will take ownership of the tag list.
The message is posted by elements that discovered a new taglist.
-}
messageNewTag ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> Gst.TagList.TagList
    {- ^ /@tagList@/: the tag list for the message. -}
    -> m Message
    {- ^ __Returns:__ the new tag message.

MT safe. -}
messageNewTag src tagList = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    tagList' <- B.ManagedPtr.disownBoxed tagList
    result <- gst_message_new_tag maybeSrc tagList'
    checkUnexpectedReturnNULL "messageNewTag" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    touchManagedPtr tagList
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_toc
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "toc", argType = TInterface (Name {namespace = "Gst", name = "Toc"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstToc structure for the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "updated", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether TOC was updated or not.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_toc" gst_message_new_toc ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr Gst.Toc.Toc ->                      -- toc : TInterface (Name {namespace = "Gst", name = "Toc"})
    CInt ->                                 -- updated : TBasicType TBoolean
    IO (Ptr Message)

{- |
Create a new TOC message. The message is posted by elements
that discovered or updated a TOC.
-}
messageNewToc ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    a
    {- ^ /@src@/: the object originating the message. -}
    -> Gst.Toc.Toc
    {- ^ /@toc@/: 'GI.Gst.Structs.Toc.Toc' structure for the message. -}
    -> Bool
    {- ^ /@updated@/: whether TOC was updated or not. -}
    -> m Message
    {- ^ __Returns:__ a new TOC message.

MT safe. -}
messageNewToc src toc updated = liftIO $ do
    src' <- unsafeManagedPtrCastPtr src
    toc' <- unsafeManagedPtrGetPtr toc
    let updated' = (fromIntegral . fromEnum) updated
    result <- gst_message_new_toc src' toc' updated'
    checkUnexpectedReturnNULL "messageNewToc" result
    result' <- (wrapBoxed Message) result
    touchManagedPtr src
    touchManagedPtr toc
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_warning
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The GError for this message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A debugging string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_warning" gst_message_new_warning ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr GError ->                           -- error : TError
    CString ->                              -- debug : TBasicType TUTF8
    IO (Ptr Message)

{- |
Create a new warning message. The message will make copies of /@error@/ and
/@debug@/.
-}
messageNewWarning ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> GError
    {- ^ /@error@/: The GError for this message. -}
    -> T.Text
    {- ^ /@debug@/: A debugging string. -}
    -> m Message
    {- ^ __Returns:__ the new warning message.

MT safe. -}
messageNewWarning src error_ debug = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    error_' <- unsafeManagedPtrGetPtr error_
    debug' <- textToCString debug
    result <- gst_message_new_warning maybeSrc error_' debug'
    checkUnexpectedReturnNULL "messageNewWarning" result
    result' <- (wrapBoxed Message) result
    whenJust src touchManagedPtr
    touchManagedPtr error_
    freeMem debug'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Message::new_warning_with_details
-- method type : Constructor
-- Args : [Arg {argCName = "src", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "The object originating the message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "error", argType = TError, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The GError for this message.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A debugging string.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "details", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "(allow-none): A GstStructure with details", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Message"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_new_warning_with_details" gst_message_new_warning_with_details ::
    Ptr Gst.Object.Object ->                -- src : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr GError ->                           -- error : TError
    CString ->                              -- debug : TBasicType TUTF8
    Ptr Gst.Structure.Structure ->          -- details : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO (Ptr Message)

{- |
Create a new warning message. The message will make copies of /@error@/ and
/@debug@/.

/Since: 1.10/
-}
messageNewWarningWithDetails ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Object.IsObject a) =>
    Maybe (a)
    {- ^ /@src@/: The object originating the message. -}
    -> GError
    {- ^ /@error@/: The GError for this message. -}
    -> T.Text
    {- ^ /@debug@/: A debugging string. -}
    -> Gst.Structure.Structure
    {- ^ /@details@/: (allow-none): A GstStructure with details -}
    -> m (Maybe Message)
    {- ^ __Returns:__ the new warning message. -}
messageNewWarningWithDetails src error_ debug details = liftIO $ do
    maybeSrc <- case src of
        Nothing -> return nullPtr
        Just jSrc -> do
            jSrc' <- unsafeManagedPtrCastPtr jSrc
            return jSrc'
    error_' <- unsafeManagedPtrGetPtr error_
    debug' <- textToCString debug
    details' <- B.ManagedPtr.disownBoxed details
    result <- gst_message_new_warning_with_details maybeSrc error_' debug' details'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapBoxed Message) result'
        return result''
    whenJust src touchManagedPtr
    touchManagedPtr error_
    touchManagedPtr details
    freeMem debug'
    return maybeResult

#if ENABLE_OVERLOADING
#endif

-- method Message::add_redirect_entry
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_REDIRECT", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "location", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location string for the new entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tag_list", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "tag list for the new entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "entry_struct", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "structure for the new entry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_add_redirect_entry" gst_message_add_redirect_entry ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    CString ->                              -- location : TBasicType TUTF8
    Ptr Gst.TagList.TagList ->              -- tag_list : TInterface (Name {namespace = "Gst", name = "TagList"})
    Ptr Gst.Structure.Structure ->          -- entry_struct : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Creates and appends a new entry.

The specified location string is copied. However, ownership over the tag
list and structure are transferred to the message.

/Since: 1.10/
-}
messageAddRedirectEntry ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeRedirect' -}
    -> T.Text
    {- ^ /@location@/: location string for the new entry -}
    -> Maybe (Gst.TagList.TagList)
    {- ^ /@tagList@/: tag list for the new entry -}
    -> Maybe (Gst.Structure.Structure)
    {- ^ /@entryStruct@/: structure for the new entry -}
    -> m ()
messageAddRedirectEntry message location tagList entryStruct = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    location' <- textToCString location
    maybeTagList <- case tagList of
        Nothing -> return nullPtr
        Just jTagList -> do
            jTagList' <- B.ManagedPtr.disownBoxed jTagList
            return jTagList'
    maybeEntryStruct <- case entryStruct of
        Nothing -> return nullPtr
        Just jEntryStruct -> do
            jEntryStruct' <- B.ManagedPtr.disownBoxed jEntryStruct
            return jEntryStruct'
    gst_message_add_redirect_entry message' location' maybeTagList maybeEntryStruct
    touchManagedPtr message
    whenJust tagList touchManagedPtr
    whenJust entryStruct touchManagedPtr
    freeMem location'
    return ()

#if ENABLE_OVERLOADING
data MessageAddRedirectEntryMethodInfo
instance (signature ~ (T.Text -> Maybe (Gst.TagList.TagList) -> Maybe (Gst.Structure.Structure) -> m ()), MonadIO m) => O.MethodInfo MessageAddRedirectEntryMethodInfo Message signature where
    overloadedMethod _ = messageAddRedirectEntry

#endif

-- method Message::get_num_redirect_entries
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_REDIRECT", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_get_num_redirect_entries" gst_message_get_num_redirect_entries ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    IO Word64

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

/Since: 1.10/
-}
messageGetNumRedirectEntries ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeRedirect' -}
    -> m Word64
    {- ^ __Returns:__ the number of entries stored in the message -}
messageGetNumRedirectEntries message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    result <- gst_message_get_num_redirect_entries message'
    touchManagedPtr message
    return result

#if ENABLE_OVERLOADING
data MessageGetNumRedirectEntriesMethodInfo
instance (signature ~ (m Word64), MonadIO m) => O.MethodInfo MessageGetNumRedirectEntriesMethodInfo Message signature where
    overloadedMethod _ = messageGetNumRedirectEntries

#endif

-- method Message::get_seqnum
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstMessage.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_get_seqnum" gst_message_get_seqnum ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    IO Word32

{- |
Retrieve the sequence number of a message.

Messages have ever-incrementing sequence numbers, which may also be set
explicitly via 'GI.Gst.Structs.Message.messageSetSeqnum'. Sequence numbers are typically used
to indicate that a message corresponds to some other set of messages or
events, for example a SEGMENT_DONE message corresponding to a SEEK event. It
is considered good practice to make this correspondence when possible, though
it is not required.

Note that events and messages share the same sequence number incrementor;
two events or messages will never have the same sequence number unless
that correspondence was made explicitly.
-}
messageGetSeqnum ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A 'GI.Gst.Structs.Message.Message'. -}
    -> m Word32
    {- ^ __Returns:__ The message\'s sequence number.

MT safe. -}
messageGetSeqnum message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    result <- gst_message_get_seqnum message'
    touchManagedPtr message
    return result

#if ENABLE_OVERLOADING
data MessageGetSeqnumMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo MessageGetSeqnumMethodInfo Message signature where
    overloadedMethod _ = messageGetSeqnum

#endif

-- method Message::get_stream_status_object
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_STREAM_STATUS.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GObject", name = "Value"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_get_stream_status_object" gst_message_get_stream_status_object ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    IO (Ptr GValue)

{- |
Extracts the object managing the streaming thread from /@message@/.
-}
messageGetStreamStatusObject ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_STREAM_STATUS. -}
    -> m (Maybe GValue)
    {- ^ __Returns:__ a GValue containing the object that manages the
streaming thread. This object is usually of type GstTask but other types can
be added in the future. The object remains valid as long as /@message@/ is
valid. -}
messageGetStreamStatusObject message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    result <- gst_message_get_stream_status_object message'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed GValue) result'
        return result''
    touchManagedPtr message
    return maybeResult

#if ENABLE_OVERLOADING
data MessageGetStreamStatusObjectMethodInfo
instance (signature ~ (m (Maybe GValue)), MonadIO m) => O.MethodInfo MessageGetStreamStatusObjectMethodInfo Message signature where
    overloadedMethod _ = messageGetStreamStatusObject

#endif

-- method Message::get_structure
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstMessage.", 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_message_get_structure" gst_message_get_structure ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    IO (Ptr Gst.Structure.Structure)

{- |
Access the structure of the message.
-}
messageGetStructure ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: The 'GI.Gst.Structs.Message.Message'. -}
    -> m (Maybe Gst.Structure.Structure)
    {- ^ __Returns:__ The structure of the message. The
structure is still owned by the message, which means that you should not
free it and that the pointer becomes invalid when you free the message.

MT safe. -}
messageGetStructure message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    result <- gst_message_get_structure message'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Gst.Structure.Structure) result'
        return result''
    touchManagedPtr message
    return maybeResult

#if ENABLE_OVERLOADING
data MessageGetStructureMethodInfo
instance (signature ~ (m (Maybe Gst.Structure.Structure)), MonadIO m) => O.MethodInfo MessageGetStructureMethodInfo Message signature where
    overloadedMethod _ = messageGetStructure

#endif

-- method Message::has_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstMessage.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "name to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_has_name" gst_message_has_name ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    CString ->                              -- name : TBasicType TUTF8
    IO CInt

{- |
Checks if /@message@/ has the given /@name@/. This function is usually used to
check the name of a custom message.
-}
messageHasName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: The 'GI.Gst.Structs.Message.Message'. -}
    -> T.Text
    {- ^ /@name@/: name to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@name@/ matches the name of the message structure. -}
messageHasName message name = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    name' <- textToCString name
    result <- gst_message_has_name message' name'
    let result' = (/= 0) result
    touchManagedPtr message
    freeMem name'
    return result'

#if ENABLE_OVERLOADING
data MessageHasNameMethodInfo
instance (signature ~ (T.Text -> m Bool), MonadIO m) => O.MethodInfo MessageHasNameMethodInfo Message signature where
    overloadedMethod _ = messageHasName

#endif

-- method Message::parse_async_done
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_ASYNC_DONE.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "running_time", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Result location for the running_time 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_message_parse_async_done" gst_message_parse_async_done ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr Word64 ->                           -- running_time : TBasicType TUInt64
    IO ()

{- |
Extract the running_time from the async_done message.

MT safe.
-}
messageParseAsyncDone ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_ASYNC_DONE. -}
    -> m (Word64)
messageParseAsyncDone message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    runningTime <- allocMem :: IO (Ptr Word64)
    gst_message_parse_async_done message' runningTime
    runningTime' <- peek runningTime
    touchManagedPtr message
    freeMem runningTime
    return runningTime'

#if ENABLE_OVERLOADING
data MessageParseAsyncDoneMethodInfo
instance (signature ~ (m (Word64)), MonadIO m) => O.MethodInfo MessageParseAsyncDoneMethodInfo Message signature where
    overloadedMethod _ = messageParseAsyncDone

#endif

-- method Message::parse_buffering
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_BUFFERING.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "percent", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Return location for the percent.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_buffering" gst_message_parse_buffering ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr Int32 ->                            -- percent : TBasicType TInt
    IO ()

{- |
Extracts the buffering percent from the GstMessage. see also
'GI.Gst.Structs.Message.messageNewBuffering'.

MT safe.
-}
messageParseBuffering ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_BUFFERING. -}
    -> m (Int32)
messageParseBuffering message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    percent <- allocMem :: IO (Ptr Int32)
    gst_message_parse_buffering message' percent
    percent' <- peek percent
    touchManagedPtr message
    freeMem percent
    return percent'

#if ENABLE_OVERLOADING
data MessageParseBufferingMethodInfo
instance (signature ~ (m (Int32)), MonadIO m) => O.MethodInfo MessageParseBufferingMethodInfo Message signature where
    overloadedMethod _ = messageParseBuffering

#endif

-- method Message::parse_buffering_stats
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_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 rate, 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_message_parse_buffering_stats" gst_message_parse_buffering_stats ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    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 /@message@/.
-}
messageParseBufferingStats ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_BUFFERING. -}
    -> m ((Gst.Enums.BufferingMode, Int32, Int32, Int64))
messageParseBufferingStats message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    mode <- allocMem :: IO (Ptr CUInt)
    avgIn <- allocMem :: IO (Ptr Int32)
    avgOut <- allocMem :: IO (Ptr Int32)
    bufferingLeft <- allocMem :: IO (Ptr Int64)
    gst_message_parse_buffering_stats message' mode avgIn avgOut bufferingLeft
    mode' <- peek mode
    let mode'' = (toEnum . fromIntegral) mode'
    avgIn' <- peek avgIn
    avgOut' <- peek avgOut
    bufferingLeft' <- peek bufferingLeft
    touchManagedPtr message
    freeMem mode
    freeMem avgIn
    freeMem avgOut
    freeMem bufferingLeft
    return (mode'', avgIn', avgOut', bufferingLeft')

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

#endif

-- method Message::parse_clock_lost
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_CLOCK_LOST.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to hold the lost clock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_clock_lost" gst_message_parse_clock_lost ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Clock.Clock) ->            -- clock : TInterface (Name {namespace = "Gst", name = "Clock"})
    IO ()

{- |
Extracts the lost clock from the GstMessage.
The clock object returned remains valid until the message is freed.

MT safe.
-}
messageParseClockLost ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_CLOCK_LOST. -}
    -> m (Gst.Clock.Clock)
messageParseClockLost message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    clock <- allocMem :: IO (Ptr (Ptr Gst.Clock.Clock))
    gst_message_parse_clock_lost message' clock
    clock' <- peek clock
    clock'' <- (newObject Gst.Clock.Clock) clock'
    touchManagedPtr message
    freeMem clock
    return clock''

#if ENABLE_OVERLOADING
data MessageParseClockLostMethodInfo
instance (signature ~ (m (Gst.Clock.Clock)), MonadIO m) => O.MethodInfo MessageParseClockLostMethodInfo Message signature where
    overloadedMethod _ = messageParseClockLost

#endif

-- method Message::parse_clock_provide
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_CLOCK_PROVIDE.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to  hold a clock\n    object, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "ready", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to hold the ready flag, 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_message_parse_clock_provide" gst_message_parse_clock_provide ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Clock.Clock) ->            -- clock : TInterface (Name {namespace = "Gst", name = "Clock"})
    Ptr CInt ->                             -- ready : TBasicType TBoolean
    IO ()

{- |
Extracts the clock and ready flag from the GstMessage.
The clock object returned remains valid until the message is freed.

MT safe.
-}
messageParseClockProvide ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_CLOCK_PROVIDE. -}
    -> m ((Gst.Clock.Clock, Bool))
messageParseClockProvide message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    clock <- allocMem :: IO (Ptr (Ptr Gst.Clock.Clock))
    ready <- allocMem :: IO (Ptr CInt)
    gst_message_parse_clock_provide message' clock ready
    clock' <- peek clock
    clock'' <- (newObject Gst.Clock.Clock) clock'
    ready' <- peek ready
    let ready'' = (/= 0) ready'
    touchManagedPtr message
    freeMem clock
    freeMem ready
    return (clock'', ready'')

#if ENABLE_OVERLOADING
data MessageParseClockProvideMethodInfo
instance (signature ~ (m ((Gst.Clock.Clock, Bool))), MonadIO m) => O.MethodInfo MessageParseClockProvideMethodInfo Message signature where
    overloadedMethod _ = messageParseClockProvide

#endif

-- method Message::parse_context_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GST_MESSAGE_NEED_CONTEXT type message", 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_message_parse_context_type" gst_message_parse_context_type ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CString ->                          -- context_type : TBasicType TUTF8
    IO CInt

{- |
Parse a context type from an existing GST_MESSAGE_NEED_CONTEXT message.

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

#if ENABLE_OVERLOADING
data MessageParseContextTypeMethodInfo
instance (signature ~ (m ((Bool, T.Text))), MonadIO m) => O.MethodInfo MessageParseContextTypeMethodInfo Message signature where
    overloadedMethod _ = messageParseContextType

#endif

-- method Message::parse_device_added
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_DEVICE_ADDED", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A location where to store a\n pointer to the new #GstDevice, 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_message_parse_device_added" gst_message_parse_device_added ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Device.Device) ->          -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    IO ()

{- |
Parses a device-added message. The device-added message is produced by
'GI.Gst.Objects.DeviceProvider.DeviceProvider' or a 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor'. It announces the appearance
of monitored devices.

/Since: 1.4/
-}
messageParseDeviceAdded ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeDeviceAdded' -}
    -> m (Gst.Device.Device)
messageParseDeviceAdded message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    device <- allocMem :: IO (Ptr (Ptr Gst.Device.Device))
    gst_message_parse_device_added message' device
    device' <- peek device
    device'' <- (wrapObject Gst.Device.Device) device'
    touchManagedPtr message
    freeMem device
    return device''

#if ENABLE_OVERLOADING
data MessageParseDeviceAddedMethodInfo
instance (signature ~ (m (Gst.Device.Device)), MonadIO m) => O.MethodInfo MessageParseDeviceAddedMethodInfo Message signature where
    overloadedMethod _ = messageParseDeviceAdded

#endif

-- method Message::parse_device_removed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_DEVICE_REMOVED", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "device", argType = TInterface (Name {namespace = "Gst", name = "Device"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A location where to store a\n pointer to the removed #GstDevice, 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_message_parse_device_removed" gst_message_parse_device_removed ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Device.Device) ->          -- device : TInterface (Name {namespace = "Gst", name = "Device"})
    IO ()

{- |
Parses a device-removed message. The device-removed message is produced by
'GI.Gst.Objects.DeviceProvider.DeviceProvider' or a 'GI.Gst.Objects.DeviceMonitor.DeviceMonitor'. It announces the
disappearance of monitored devices.

/Since: 1.4/
-}
messageParseDeviceRemoved ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeDeviceRemoved' -}
    -> m (Gst.Device.Device)
messageParseDeviceRemoved message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    device <- allocMem :: IO (Ptr (Ptr Gst.Device.Device))
    gst_message_parse_device_removed message' device
    device' <- peek device
    device'' <- (wrapObject Gst.Device.Device) device'
    touchManagedPtr message
    freeMem device
    return device''

#if ENABLE_OVERLOADING
data MessageParseDeviceRemovedMethodInfo
instance (signature ~ (m (Gst.Device.Device)), MonadIO m) => O.MethodInfo MessageParseDeviceRemovedMethodInfo Message signature where
    overloadedMethod _ = messageParseDeviceRemoved

#endif

-- method Message::parse_error
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_ERROR.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "gerror", argType = TError, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location for the GError", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location for the debug message,\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_message_parse_error" gst_message_parse_error ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr GError) ->                     -- gerror : TError
    Ptr CString ->                          -- debug : TBasicType TUTF8
    IO ()

{- |
Extracts the GError and debug string from the GstMessage. The values returned
in the output arguments are copies; the caller must free them when done.

Typical usage of this function might be:

=== /C code/
>
>  ...
>  switch (GST_MESSAGE_TYPE (msg)) {
>    case GST_MESSAGE_ERROR: {
>      GError *err = NULL;
>      gchar *dbg_info = NULL;
>
>      gst_message_parse_error (msg, &amp;err, &amp;dbg_info);
>      g_printerr ("ERROR from element %s: %s\n",
>          GST_OBJECT_NAME (msg->src), err->message);
>      g_printerr ("Debugging info: %s\n", (dbg_info) ? dbg_info : "none");
>      g_error_free (err);
>      g_free (dbg_info);
>      break;
>    }
>    ...
>  }
>  ...


MT safe.
-}
messageParseError ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_ERROR. -}
    -> m ((GError, T.Text))
messageParseError message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    gerror <- allocMem :: IO (Ptr (Ptr GError))
    debug <- allocMem :: IO (Ptr CString)
    gst_message_parse_error message' gerror debug
    gerror' <- peek gerror
    gerror'' <- (wrapBoxed GError) gerror'
    debug' <- peek debug
    debug'' <- cstringToText debug'
    freeMem debug'
    touchManagedPtr message
    freeMem gerror
    freeMem debug
    return (gerror'', debug'')

#if ENABLE_OVERLOADING
data MessageParseErrorMethodInfo
instance (signature ~ (m ((GError, T.Text))), MonadIO m) => O.MethodInfo MessageParseErrorMethodInfo Message signature where
    overloadedMethod _ = messageParseError

#endif

-- method Message::parse_error_details
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The message object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to the returned details", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_error_details" gst_message_parse_error_details ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Structure.Structure) ->    -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Returns the optional details structure, may be NULL if none.
The returned structure must not be freed.

/Since: 1.10/
-}
messageParseErrorDetails ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: The message object -}
    -> m (Gst.Structure.Structure)
messageParseErrorDetails message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    structure <- allocMem :: IO (Ptr (Ptr Gst.Structure.Structure))
    gst_message_parse_error_details message' structure
    structure' <- peek structure
    structure'' <- (newBoxed Gst.Structure.Structure) structure'
    touchManagedPtr message
    freeMem structure
    return structure''

#if ENABLE_OVERLOADING
data MessageParseErrorDetailsMethodInfo
instance (signature ~ (m (Gst.Structure.Structure)), MonadIO m) => O.MethodInfo MessageParseErrorDetailsMethodInfo Message signature where
    overloadedMethod _ = messageParseErrorDetails

#endif

-- method Message::parse_group_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_STREAM_START.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_id", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Result location for the group id or\n     %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_message_parse_group_id" gst_message_parse_group_id ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr Word32 ->                           -- group_id : TBasicType TUInt
    IO CInt

{- |
Extract the group from the STREAM_START message.

/Since: 1.2/
-}
messageParseGroupId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_STREAM_START. -}
    -> m ((Bool, Word32))
    {- ^ __Returns:__ 'True' if the message had a group id set, 'False' otherwise

MT safe. -}
messageParseGroupId message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    groupId <- allocMem :: IO (Ptr Word32)
    result <- gst_message_parse_group_id message' groupId
    let result' = (/= 0) result
    groupId' <- peek groupId
    touchManagedPtr message
    freeMem groupId
    return (result', groupId')

#if ENABLE_OVERLOADING
data MessageParseGroupIdMethodInfo
instance (signature ~ (m ((Bool, Word32))), MonadIO m) => O.MethodInfo MessageParseGroupIdMethodInfo Message signature where
    overloadedMethod _ = messageParseGroupId

#endif

-- method Message::parse_have_context
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_HAVE_CONTEXT.", 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 "Result location for the\n     context 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_message_parse_have_context" gst_message_parse_have_context ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Context.Context) ->        -- context : TInterface (Name {namespace = "Gst", name = "Context"})
    IO ()

{- |
Extract the context from the HAVE_CONTEXT message.

MT safe.

/Since: 1.2/
-}
messageParseHaveContext ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_HAVE_CONTEXT. -}
    -> m (Gst.Context.Context)
messageParseHaveContext message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    context <- allocMem :: IO (Ptr (Ptr Gst.Context.Context))
    gst_message_parse_have_context message' context
    context' <- peek context
    context'' <- (wrapBoxed Gst.Context.Context) context'
    touchManagedPtr message
    freeMem context
    return context''

#if ENABLE_OVERLOADING
data MessageParseHaveContextMethodInfo
instance (signature ~ (m (Gst.Context.Context)), MonadIO m) => O.MethodInfo MessageParseHaveContextMethodInfo Message signature where
    overloadedMethod _ = messageParseHaveContext

#endif

-- method Message::parse_info
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_INFO.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "gerror", argType = TError, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location for the GError", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location for the debug message,\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_message_parse_info" gst_message_parse_info ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr GError) ->                     -- gerror : TError
    Ptr CString ->                          -- debug : TBasicType TUTF8
    IO ()

{- |
Extracts the GError and debug string from the GstMessage. The values returned
in the output arguments are copies; the caller must free them when done.

MT safe.
-}
messageParseInfo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_INFO. -}
    -> m ((GError, T.Text))
messageParseInfo message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    gerror <- allocMem :: IO (Ptr (Ptr GError))
    debug <- allocMem :: IO (Ptr CString)
    gst_message_parse_info message' gerror debug
    gerror' <- peek gerror
    gerror'' <- (wrapBoxed GError) gerror'
    debug' <- peek debug
    debug'' <- cstringToText debug'
    freeMem debug'
    touchManagedPtr message
    freeMem gerror
    freeMem debug
    return (gerror'', debug'')

#if ENABLE_OVERLOADING
data MessageParseInfoMethodInfo
instance (signature ~ (m ((GError, T.Text))), MonadIO m) => O.MethodInfo MessageParseInfoMethodInfo Message signature where
    overloadedMethod _ = messageParseInfo

#endif

-- method Message::parse_info_details
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The message object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to the returned details structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_info_details" gst_message_parse_info_details ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Structure.Structure) ->    -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Returns the optional details structure, may be NULL if none
The returned structure must not be freed.

/Since: 1.10/
-}
messageParseInfoDetails ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: The message object -}
    -> m (Gst.Structure.Structure)
messageParseInfoDetails message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    structure <- allocMem :: IO (Ptr (Ptr Gst.Structure.Structure))
    gst_message_parse_info_details message' structure
    structure' <- peek structure
    structure'' <- (newBoxed Gst.Structure.Structure) structure'
    touchManagedPtr message
    freeMem structure
    return structure''

#if ENABLE_OVERLOADING
data MessageParseInfoDetailsMethodInfo
instance (signature ~ (m (Gst.Structure.Structure)), MonadIO m) => O.MethodInfo MessageParseInfoDetailsMethodInfo Message signature where
    overloadedMethod _ = messageParseInfoDetails

#endif

-- method Message::parse_new_clock
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_NEW_CLOCK.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to hold the selected\n    new clock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_new_clock" gst_message_parse_new_clock ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Clock.Clock) ->            -- clock : TInterface (Name {namespace = "Gst", name = "Clock"})
    IO ()

{- |
Extracts the new clock from the GstMessage.
The clock object returned remains valid until the message is freed.

MT safe.
-}
messageParseNewClock ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_NEW_CLOCK. -}
    -> m (Gst.Clock.Clock)
messageParseNewClock message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    clock <- allocMem :: IO (Ptr (Ptr Gst.Clock.Clock))
    gst_message_parse_new_clock message' clock
    clock' <- peek clock
    clock'' <- (newObject Gst.Clock.Clock) clock'
    touchManagedPtr message
    freeMem clock
    return clock''

#if ENABLE_OVERLOADING
data MessageParseNewClockMethodInfo
instance (signature ~ (m (Gst.Clock.Clock)), MonadIO m) => O.MethodInfo MessageParseNewClockMethodInfo Message signature where
    overloadedMethod _ = messageParseNewClock

#endif

-- method Message::parse_progress
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_PROGRESS.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "ProgressType"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location for the type", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "code", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location for the code", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "text", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location for the text", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_progress" gst_message_parse_progress ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CUInt ->                            -- type : TInterface (Name {namespace = "Gst", name = "ProgressType"})
    Ptr CString ->                          -- code : TBasicType TUTF8
    Ptr CString ->                          -- text : TBasicType TUTF8
    IO ()

{- |
Parses the progress /@type@/, /@code@/ and /@text@/.
-}
messageParseProgress ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_PROGRESS. -}
    -> m ((Gst.Enums.ProgressType, T.Text, T.Text))
messageParseProgress message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    type_ <- allocMem :: IO (Ptr CUInt)
    code <- allocMem :: IO (Ptr CString)
    text <- allocMem :: IO (Ptr CString)
    gst_message_parse_progress message' type_ code text
    type_' <- peek type_
    let type_'' = (toEnum . fromIntegral) type_'
    code' <- peek code
    code'' <- cstringToText code'
    freeMem code'
    text' <- peek text
    text'' <- cstringToText text'
    freeMem text'
    touchManagedPtr message
    freeMem type_
    freeMem code
    freeMem text
    return (type_'', code'', text'')

#if ENABLE_OVERLOADING
data MessageParseProgressMethodInfo
instance (signature ~ (m ((Gst.Enums.ProgressType, T.Text, T.Text))), MonadIO m) => O.MethodInfo MessageParseProgressMethodInfo Message signature where
    overloadedMethod _ = messageParseProgress

#endif

-- method Message::parse_property_notify
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_PROPERTY_NOTIFY", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object", argType = TInterface (Name {namespace = "Gst", name = "Object"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location where to store a\n    pointer to the object whose property got changed, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_name", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for\n    the name of the property that got changed, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_value", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for\n    the new value of the property that got changed, or %NULL. This will\n    only be set if the property notify watch was told to include the value\n    when it was set up", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_property_notify" gst_message_parse_property_notify ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Object.Object) ->          -- object : TInterface (Name {namespace = "Gst", name = "Object"})
    Ptr CString ->                          -- property_name : TBasicType TUTF8
    Ptr (Ptr GValue) ->                     -- property_value : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
Parses a property-notify message. These will be posted on the bus only
when set up with 'GI.Gst.Objects.Element.elementAddPropertyNotifyWatch' or
'GI.Gst.Objects.Element.elementAddPropertyDeepNotifyWatch'.

/Since: 1.10/
-}
messageParsePropertyNotify ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypePropertyNotify' -}
    -> m ((Gst.Object.Object, T.Text, GValue))
messageParsePropertyNotify message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    object <- allocMem :: IO (Ptr (Ptr Gst.Object.Object))
    propertyName <- allocMem :: IO (Ptr CString)
    propertyValue <- allocMem :: IO (Ptr (Ptr GValue))
    gst_message_parse_property_notify message' object propertyName propertyValue
    object' <- peek object
    object'' <- (newObject Gst.Object.Object) object'
    propertyName' <- peek propertyName
    propertyName'' <- cstringToText propertyName'
    propertyValue' <- peek propertyValue
    propertyValue'' <- (newBoxed GValue) propertyValue'
    touchManagedPtr message
    freeMem object
    freeMem propertyName
    freeMem propertyValue
    return (object'', propertyName'', propertyValue'')

#if ENABLE_OVERLOADING
data MessageParsePropertyNotifyMethodInfo
instance (signature ~ (m ((Gst.Object.Object, T.Text, GValue))), MonadIO m) => O.MethodInfo MessageParsePropertyNotifyMethodInfo Message signature where
    overloadedMethod _ = messageParsePropertyNotify

#endif

-- method Message::parse_qos
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_QOS.", 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 "if the message was generated by a live element", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "running_time", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the running time of the buffer that\n    generated the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "stream_time", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the stream time of the buffer that\n    generated the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the timestamps of the buffer that\n    generated the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "duration", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the duration of the buffer that\n    generated the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_qos" gst_message_parse_qos ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CInt ->                             -- live : TBasicType TBoolean
    Ptr Word64 ->                           -- running_time : TBasicType TUInt64
    Ptr Word64 ->                           -- stream_time : TBasicType TUInt64
    Ptr Word64 ->                           -- timestamp : TBasicType TUInt64
    Ptr Word64 ->                           -- duration : TBasicType TUInt64
    IO ()

{- |
Extract the timestamps and live status from the QoS message.

The returned values give the running_time, stream_time, timestamp and
duration of the dropped buffer. Values of GST_CLOCK_TIME_NONE mean unknown
values.

MT safe.
-}
messageParseQos ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_QOS. -}
    -> m ((Bool, Word64, Word64, Word64, Word64))
messageParseQos message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    live <- allocMem :: IO (Ptr CInt)
    runningTime <- allocMem :: IO (Ptr Word64)
    streamTime <- allocMem :: IO (Ptr Word64)
    timestamp <- allocMem :: IO (Ptr Word64)
    duration <- allocMem :: IO (Ptr Word64)
    gst_message_parse_qos message' live runningTime streamTime timestamp duration
    live' <- peek live
    let live'' = (/= 0) live'
    runningTime' <- peek runningTime
    streamTime' <- peek streamTime
    timestamp' <- peek timestamp
    duration' <- peek duration
    touchManagedPtr message
    freeMem live
    freeMem runningTime
    freeMem streamTime
    freeMem timestamp
    freeMem duration
    return (live'', runningTime', streamTime', timestamp', duration')

#if ENABLE_OVERLOADING
data MessageParseQosMethodInfo
instance (signature ~ (m ((Bool, Word64, Word64, Word64, Word64))), MonadIO m) => O.MethodInfo MessageParseQosMethodInfo Message signature where
    overloadedMethod _ = messageParseQos

#endif

-- method Message::parse_qos_stats
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_QOS.", 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 "Units of the 'processed' and 'dropped' fields.\n    Video sinks and video filters will use GST_FORMAT_BUFFERS (frames).\n    Audio sinks and audio filters will likely use GST_FORMAT_DEFAULT\n    (samples).", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "processed", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Total number of units correctly processed\n    since the last state change to READY or a flushing operation.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "dropped", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Total number of units dropped since the last\n    state change to READY or a flushing operation.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_qos_stats" gst_message_parse_qos_stats ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Word64 ->                           -- processed : TBasicType TUInt64
    Ptr Word64 ->                           -- dropped : TBasicType TUInt64
    IO ()

{- |
Extract the QoS stats representing the history of the current continuous
pipeline playback period.

When /@format@/ is /@gSTFORMATUNDEFINED@/ both /@dropped@/ and /@processed@/ are
invalid. Values of -1 for either /@processed@/ or /@dropped@/ mean unknown values.

MT safe.
-}
messageParseQosStats ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_QOS. -}
    -> m ((Gst.Enums.Format, Word64, Word64))
messageParseQosStats message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    format <- allocMem :: IO (Ptr CUInt)
    processed <- allocMem :: IO (Ptr Word64)
    dropped <- allocMem :: IO (Ptr Word64)
    gst_message_parse_qos_stats message' format processed dropped
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    processed' <- peek processed
    dropped' <- peek dropped
    touchManagedPtr message
    freeMem format
    freeMem processed
    freeMem dropped
    return (format'', processed', dropped')

#if ENABLE_OVERLOADING
data MessageParseQosStatsMethodInfo
instance (signature ~ (m ((Gst.Enums.Format, Word64, Word64))), MonadIO m) => O.MethodInfo MessageParseQosStatsMethodInfo Message signature where
    overloadedMethod _ = messageParseQosStats

#endif

-- method Message::parse_qos_values
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_QOS.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "jitter", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The difference of the running-time against\n    the deadline.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "proportion", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Long term prediction of the ideal rate\n    relative to normal rate to get optimal quality.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "quality", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An element dependent integer value that\n    specifies the current quality level of the element. The default\n    maximum quality is 1000000.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_qos_values" gst_message_parse_qos_values ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr Int64 ->                            -- jitter : TBasicType TInt64
    Ptr CDouble ->                          -- proportion : TBasicType TDouble
    Ptr Int32 ->                            -- quality : TBasicType TInt
    IO ()

{- |
Extract the QoS values that have been calculated\/analysed from the QoS data

MT safe.
-}
messageParseQosValues ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_QOS. -}
    -> m ((Int64, Double, Int32))
messageParseQosValues message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    jitter <- allocMem :: IO (Ptr Int64)
    proportion <- allocMem :: IO (Ptr CDouble)
    quality <- allocMem :: IO (Ptr Int32)
    gst_message_parse_qos_values message' jitter proportion quality
    jitter' <- peek jitter
    proportion' <- peek proportion
    let proportion'' = realToFrac proportion'
    quality' <- peek quality
    touchManagedPtr message
    freeMem jitter
    freeMem proportion
    freeMem quality
    return (jitter', proportion'', quality')

#if ENABLE_OVERLOADING
data MessageParseQosValuesMethodInfo
instance (signature ~ (m ((Int64, Double, Int32))), MonadIO m) => O.MethodInfo MessageParseQosValuesMethodInfo Message signature where
    overloadedMethod _ = messageParseQosValues

#endif

-- method Message::parse_redirect_entry
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_REDIRECT", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "entry_index", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "index of the entry to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "location", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for\n    the pointer to the entry's location string, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tag_list", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for\n    the pointer to the entry's tag list, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "entry_struct", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location\n    for the pointer to the entry's structure, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_redirect_entry" gst_message_parse_redirect_entry ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Word64 ->                               -- entry_index : TBasicType TUInt64
    Ptr CString ->                          -- location : TBasicType TUTF8
    Ptr (Ptr Gst.TagList.TagList) ->        -- tag_list : TInterface (Name {namespace = "Gst", name = "TagList"})
    Ptr (Ptr Gst.Structure.Structure) ->    -- entry_struct : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Parses the location and\/or structure from the entry with the given index.
The index must be between 0 and 'GI.Gst.Structs.Message.messageGetNumRedirectEntries' - 1.
Returned pointers are valid for as long as this message exists.

/Since: 1.10/
-}
messageParseRedirectEntry ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeRedirect' -}
    -> Word64
    {- ^ /@entryIndex@/: index of the entry to parse -}
    -> m ((T.Text, Gst.TagList.TagList, Gst.Structure.Structure))
messageParseRedirectEntry message entryIndex = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    location <- allocMem :: IO (Ptr CString)
    tagList <- allocMem :: IO (Ptr (Ptr Gst.TagList.TagList))
    entryStruct <- allocMem :: IO (Ptr (Ptr Gst.Structure.Structure))
    gst_message_parse_redirect_entry message' entryIndex location tagList entryStruct
    location' <- peek location
    location'' <- cstringToText location'
    tagList' <- peek tagList
    tagList'' <- (newBoxed Gst.TagList.TagList) tagList'
    entryStruct' <- peek entryStruct
    entryStruct'' <- (newBoxed Gst.Structure.Structure) entryStruct'
    touchManagedPtr message
    freeMem location
    freeMem tagList
    freeMem entryStruct
    return (location'', tagList'', entryStruct'')

#if ENABLE_OVERLOADING
data MessageParseRedirectEntryMethodInfo
instance (signature ~ (Word64 -> m ((T.Text, Gst.TagList.TagList, Gst.Structure.Structure))), MonadIO m) => O.MethodInfo MessageParseRedirectEntryMethodInfo Message signature where
    overloadedMethod _ = messageParseRedirectEntry

#endif

-- method Message::parse_request_state
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_REQUEST_STATE.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "state", argType = TInterface (Name {namespace = "Gst", name = "State"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Result location for the requested state 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_message_parse_request_state" gst_message_parse_request_state ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CUInt ->                            -- state : TInterface (Name {namespace = "Gst", name = "State"})
    IO ()

{- |
Extract the requested state from the request_state message.

MT safe.
-}
messageParseRequestState ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_REQUEST_STATE. -}
    -> m (Gst.Enums.State)
messageParseRequestState message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    state <- allocMem :: IO (Ptr CUInt)
    gst_message_parse_request_state message' state
    state' <- peek state
    let state'' = (toEnum . fromIntegral) state'
    touchManagedPtr message
    freeMem state
    return state''

#if ENABLE_OVERLOADING
data MessageParseRequestStateMethodInfo
instance (signature ~ (m (Gst.Enums.State)), MonadIO m) => O.MethodInfo MessageParseRequestStateMethodInfo Message signature where
    overloadedMethod _ = messageParseRequestState

#endif

-- method Message::parse_reset_time
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_RESET_TIME.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "running_time", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Result location for the running_time or\n     %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_message_parse_reset_time" gst_message_parse_reset_time ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr Word64 ->                           -- running_time : TBasicType TUInt64
    IO ()

{- |
Extract the running-time from the RESET_TIME message.

MT safe.
-}
messageParseResetTime ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_RESET_TIME. -}
    -> m (Word64)
messageParseResetTime message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    runningTime <- allocMem :: IO (Ptr Word64)
    gst_message_parse_reset_time message' runningTime
    runningTime' <- peek runningTime
    touchManagedPtr message
    freeMem runningTime
    return runningTime'

#if ENABLE_OVERLOADING
data MessageParseResetTimeMethodInfo
instance (signature ~ (m (Word64)), MonadIO m) => O.MethodInfo MessageParseResetTimeMethodInfo Message signature where
    overloadedMethod _ = messageParseResetTime

#endif

-- method Message::parse_segment_done
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_SEGMENT_DONE.", 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 "Result location for the format, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "position", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Result location for the position, 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_message_parse_segment_done" gst_message_parse_segment_done ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- position : TBasicType TInt64
    IO ()

{- |
Extracts the position and format from the segment done message.

MT safe.
-}
messageParseSegmentDone ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_SEGMENT_DONE. -}
    -> m ((Gst.Enums.Format, Int64))
messageParseSegmentDone message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    format <- allocMem :: IO (Ptr CUInt)
    position <- allocMem :: IO (Ptr Int64)
    gst_message_parse_segment_done message' format position
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    position' <- peek position
    touchManagedPtr message
    freeMem format
    freeMem position
    return (format'', position')

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

#endif

-- method Message::parse_segment_start
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_SEGMENT_START.", 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 "Result location for the format, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "position", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Result location for the position, 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_message_parse_segment_start" gst_message_parse_segment_start ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Int64 ->                            -- position : TBasicType TInt64
    IO ()

{- |
Extracts the position and format from the segment start message.

MT safe.
-}
messageParseSegmentStart ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_SEGMENT_START. -}
    -> m ((Gst.Enums.Format, Int64))
messageParseSegmentStart message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    format <- allocMem :: IO (Ptr CUInt)
    position <- allocMem :: IO (Ptr Int64)
    gst_message_parse_segment_start message' format position
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    position' <- peek position
    touchManagedPtr message
    freeMem format
    freeMem position
    return (format'', position')

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

#endif

-- method Message::parse_state_changed
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid #GstMessage of type GST_MESSAGE_STATE_CHANGED", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "oldstate", argType = TInterface (Name {namespace = "Gst", name = "State"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the previous state, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "newstate", argType = TInterface (Name {namespace = "Gst", name = "State"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new (current) state, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "pending", argType = TInterface (Name {namespace = "Gst", name = "State"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the pending (target) state, 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_message_parse_state_changed" gst_message_parse_state_changed ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CUInt ->                            -- oldstate : TInterface (Name {namespace = "Gst", name = "State"})
    Ptr CUInt ->                            -- newstate : TInterface (Name {namespace = "Gst", name = "State"})
    Ptr CUInt ->                            -- pending : TInterface (Name {namespace = "Gst", name = "State"})
    IO ()

{- |
Extracts the old and new states from the GstMessage.

Typical usage of this function might be:

=== /C code/
>
>  ...
>  switch (GST_MESSAGE_TYPE (msg)) {
>    case GST_MESSAGE_STATE_CHANGED: {
>      GstState old_state, new_state;
>
>      gst_message_parse_state_changed (msg, &amp;old_state, &amp;new_state, NULL);
>      g_print ("Element %s changed state from %s to %s.\n",
>          GST_OBJECT_NAME (msg->src),
>          gst_element_state_get_name (old_state),
>          gst_element_state_get_name (new_state));
>      break;
>    }
>    ...
>  }
>  ...


MT safe.
-}
messageParseStateChanged ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_STATE_CHANGED -}
    -> m ((Gst.Enums.State, Gst.Enums.State, Gst.Enums.State))
messageParseStateChanged message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    oldstate <- allocMem :: IO (Ptr CUInt)
    newstate <- allocMem :: IO (Ptr CUInt)
    pending <- allocMem :: IO (Ptr CUInt)
    gst_message_parse_state_changed message' oldstate newstate pending
    oldstate' <- peek oldstate
    let oldstate'' = (toEnum . fromIntegral) oldstate'
    newstate' <- peek newstate
    let newstate'' = (toEnum . fromIntegral) newstate'
    pending' <- peek pending
    let pending'' = (toEnum . fromIntegral) pending'
    touchManagedPtr message
    freeMem oldstate
    freeMem newstate
    freeMem pending
    return (oldstate'', newstate'', pending'')

#if ENABLE_OVERLOADING
data MessageParseStateChangedMethodInfo
instance (signature ~ (m ((Gst.Enums.State, Gst.Enums.State, Gst.Enums.State))), MonadIO m) => O.MethodInfo MessageParseStateChangedMethodInfo Message signature where
    overloadedMethod _ = messageParseStateChanged

#endif

-- method Message::parse_step_done
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_STEP_DONE.", 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 "result location for the format", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "amount", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the amount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "rate", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "flush", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the flush flag", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "intermediate", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the intermediate flag", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "duration", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the duration", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "eos", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the EOS flag", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_step_done" gst_message_parse_step_done ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Word64 ->                           -- amount : TBasicType TUInt64
    Ptr CDouble ->                          -- rate : TBasicType TDouble
    Ptr CInt ->                             -- flush : TBasicType TBoolean
    Ptr CInt ->                             -- intermediate : TBasicType TBoolean
    Ptr Word64 ->                           -- duration : TBasicType TUInt64
    Ptr CInt ->                             -- eos : TBasicType TBoolean
    IO ()

{- |
Extract the values the step_done message.

MT safe.
-}
messageParseStepDone ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_STEP_DONE. -}
    -> m ((Gst.Enums.Format, Word64, Double, Bool, Bool, Word64, Bool))
messageParseStepDone message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    format <- allocMem :: IO (Ptr CUInt)
    amount <- allocMem :: IO (Ptr Word64)
    rate <- allocMem :: IO (Ptr CDouble)
    flush <- allocMem :: IO (Ptr CInt)
    intermediate <- allocMem :: IO (Ptr CInt)
    duration <- allocMem :: IO (Ptr Word64)
    eos <- allocMem :: IO (Ptr CInt)
    gst_message_parse_step_done message' format amount rate flush intermediate duration eos
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    amount' <- peek amount
    rate' <- peek rate
    let rate'' = realToFrac rate'
    flush' <- peek flush
    let flush'' = (/= 0) flush'
    intermediate' <- peek intermediate
    let intermediate'' = (/= 0) intermediate'
    duration' <- peek duration
    eos' <- peek eos
    let eos'' = (/= 0) eos'
    touchManagedPtr message
    freeMem format
    freeMem amount
    freeMem rate
    freeMem flush
    freeMem intermediate
    freeMem duration
    freeMem eos
    return (format'', amount', rate'', flush'', intermediate'', duration', eos'')

#if ENABLE_OVERLOADING
data MessageParseStepDoneMethodInfo
instance (signature ~ (m ((Gst.Enums.Format, Word64, Double, Bool, Bool, Word64, Bool))), MonadIO m) => O.MethodInfo MessageParseStepDoneMethodInfo Message signature where
    overloadedMethod _ = messageParseStepDone

#endif

-- method Message::parse_step_start
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_STEP_DONE.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "active", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the active flag", 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 "result location for the format", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "amount", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the amount", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "rate", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "flush", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the flush flag", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "intermediate", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "result location for the intermediate flag", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_step_start" gst_message_parse_step_start ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CInt ->                             -- active : TBasicType TBoolean
    Ptr CUInt ->                            -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Ptr Word64 ->                           -- amount : TBasicType TUInt64
    Ptr CDouble ->                          -- rate : TBasicType TDouble
    Ptr CInt ->                             -- flush : TBasicType TBoolean
    Ptr CInt ->                             -- intermediate : TBasicType TBoolean
    IO ()

{- |
Extract the values from step_start message.

MT safe.
-}
messageParseStepStart ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_STEP_DONE. -}
    -> m ((Bool, Gst.Enums.Format, Word64, Double, Bool, Bool))
messageParseStepStart message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    active <- allocMem :: IO (Ptr CInt)
    format <- allocMem :: IO (Ptr CUInt)
    amount <- allocMem :: IO (Ptr Word64)
    rate <- allocMem :: IO (Ptr CDouble)
    flush <- allocMem :: IO (Ptr CInt)
    intermediate <- allocMem :: IO (Ptr CInt)
    gst_message_parse_step_start message' active format amount rate flush intermediate
    active' <- peek active
    let active'' = (/= 0) active'
    format' <- peek format
    let format'' = (toEnum . fromIntegral) format'
    amount' <- peek amount
    rate' <- peek rate
    let rate'' = realToFrac rate'
    flush' <- peek flush
    let flush'' = (/= 0) flush'
    intermediate' <- peek intermediate
    let intermediate'' = (/= 0) intermediate'
    touchManagedPtr message
    freeMem active
    freeMem format
    freeMem amount
    freeMem rate
    freeMem flush
    freeMem intermediate
    return (active'', format'', amount', rate'', flush'', intermediate'')

#if ENABLE_OVERLOADING
data MessageParseStepStartMethodInfo
instance (signature ~ (m ((Bool, Gst.Enums.Format, Word64, Double, Bool, Bool))), MonadIO m) => O.MethodInfo MessageParseStepStartMethodInfo Message signature where
    overloadedMethod _ = messageParseStepStart

#endif

-- method Message::parse_stream_collection
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_STREAM_COLLECTION", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "collection", argType = TInterface (Name {namespace = "Gst", name = "StreamCollection"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A location where to store a\n pointer to the #GstStreamCollection, 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_message_parse_stream_collection" gst_message_parse_stream_collection ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.StreamCollection.StreamCollection) -> -- collection : TInterface (Name {namespace = "Gst", name = "StreamCollection"})
    IO ()

{- |
Parses a stream-collection message.

/Since: 1.10/
-}
messageParseStreamCollection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeStreamCollection' -}
    -> m (Gst.StreamCollection.StreamCollection)
messageParseStreamCollection message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    collection <- allocMem :: IO (Ptr (Ptr Gst.StreamCollection.StreamCollection))
    gst_message_parse_stream_collection message' collection
    collection' <- peek collection
    collection'' <- (wrapObject Gst.StreamCollection.StreamCollection) collection'
    touchManagedPtr message
    freeMem collection
    return collection''

#if ENABLE_OVERLOADING
data MessageParseStreamCollectionMethodInfo
instance (signature ~ (m (Gst.StreamCollection.StreamCollection)), MonadIO m) => O.MethodInfo MessageParseStreamCollectionMethodInfo Message signature where
    overloadedMethod _ = messageParseStreamCollection

#endif

-- method Message::parse_stream_status
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_STREAM_STATUS.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "StreamStatusType"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to hold the status type", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "owner", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The owner element of the message source", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_stream_status" gst_message_parse_stream_status ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CUInt ->                            -- type : TInterface (Name {namespace = "Gst", name = "StreamStatusType"})
    Ptr (Ptr Gst.Element.Element) ->        -- owner : TInterface (Name {namespace = "Gst", name = "Element"})
    IO ()

{- |
Extracts the stream status type and owner the GstMessage. The returned
owner remains valid for as long as the reference to /@message@/ is valid and
should thus not be unreffed.

MT safe.
-}
messageParseStreamStatus ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_STREAM_STATUS. -}
    -> m ((Gst.Enums.StreamStatusType, Gst.Element.Element))
messageParseStreamStatus message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    type_ <- allocMem :: IO (Ptr CUInt)
    owner <- allocMem :: IO (Ptr (Ptr Gst.Element.Element))
    gst_message_parse_stream_status message' type_ owner
    type_' <- peek type_
    let type_'' = (toEnum . fromIntegral) type_'
    owner' <- peek owner
    owner'' <- (newObject Gst.Element.Element) owner'
    touchManagedPtr message
    freeMem type_
    freeMem owner
    return (type_'', owner'')

#if ENABLE_OVERLOADING
data MessageParseStreamStatusMethodInfo
instance (signature ~ (m ((Gst.Enums.StreamStatusType, Gst.Element.Element))), MonadIO m) => O.MethodInfo MessageParseStreamStatusMethodInfo Message signature where
    overloadedMethod _ = messageParseStreamStatus

#endif

-- method Message::parse_streams_selected
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_STREAMS_SELECTED", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "collection", argType = TInterface (Name {namespace = "Gst", name = "StreamCollection"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A location where to store a\n pointer to the #GstStreamCollection, 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_message_parse_streams_selected" gst_message_parse_streams_selected ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.StreamCollection.StreamCollection) -> -- collection : TInterface (Name {namespace = "Gst", name = "StreamCollection"})
    IO ()

{- |
Parses a streams-selected message.

/Since: 1.10/
-}
messageParseStreamsSelected ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeStreamsSelected' -}
    -> m (Gst.StreamCollection.StreamCollection)
messageParseStreamsSelected message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    collection <- allocMem :: IO (Ptr (Ptr Gst.StreamCollection.StreamCollection))
    gst_message_parse_streams_selected message' collection
    collection' <- peek collection
    collection'' <- (wrapObject Gst.StreamCollection.StreamCollection) collection'
    touchManagedPtr message
    freeMem collection
    return collection''

#if ENABLE_OVERLOADING
data MessageParseStreamsSelectedMethodInfo
instance (signature ~ (m (Gst.StreamCollection.StreamCollection)), MonadIO m) => O.MethodInfo MessageParseStreamsSelectedMethodInfo Message signature where
    overloadedMethod _ = messageParseStreamsSelected

#endif

-- method Message::parse_structure_change
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_STRUCTURE_CHANGE.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "StructureChangeType"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to hold the change type", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "owner", argType = TInterface (Name {namespace = "Gst", name = "Element"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The owner element of the\n    message source", 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 "a pointer to hold whether the change is in\n    progress or has been completed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_structure_change" gst_message_parse_structure_change ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr CUInt ->                            -- type : TInterface (Name {namespace = "Gst", name = "StructureChangeType"})
    Ptr (Ptr Gst.Element.Element) ->        -- owner : TInterface (Name {namespace = "Gst", name = "Element"})
    Ptr CInt ->                             -- busy : TBasicType TBoolean
    IO ()

{- |
Extracts the change type and completion status from the GstMessage.

MT safe.
-}
messageParseStructureChange ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_STRUCTURE_CHANGE. -}
    -> m ((Gst.Enums.StructureChangeType, Gst.Element.Element, Bool))
messageParseStructureChange message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    type_ <- allocMem :: IO (Ptr CUInt)
    owner <- allocMem :: IO (Ptr (Ptr Gst.Element.Element))
    busy <- allocMem :: IO (Ptr CInt)
    gst_message_parse_structure_change message' type_ owner busy
    type_' <- peek type_
    let type_'' = (toEnum . fromIntegral) type_'
    owner' <- peek owner
    owner'' <- (newObject Gst.Element.Element) owner'
    busy' <- peek busy
    let busy'' = (/= 0) busy'
    touchManagedPtr message
    freeMem type_
    freeMem owner
    freeMem busy
    return (type_'', owner'', busy'')

#if ENABLE_OVERLOADING
data MessageParseStructureChangeMethodInfo
instance (signature ~ (m ((Gst.Enums.StructureChangeType, Gst.Element.Element, Bool))), MonadIO m) => O.MethodInfo MessageParseStructureChangeMethodInfo Message signature where
    overloadedMethod _ = messageParseStructureChange

#endif

-- method Message::parse_tag
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_TAG.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tag_list", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the tag-list.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_tag" gst_message_parse_tag ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.TagList.TagList) ->        -- tag_list : TInterface (Name {namespace = "Gst", name = "TagList"})
    IO ()

{- |
Extracts the tag list from the GstMessage. The tag list returned in the
output argument is a copy; the caller must free it when done.

Typical usage of this function might be:

=== /C code/
>
>  ...
>  switch (GST_MESSAGE_TYPE (msg)) {
>    case GST_MESSAGE_TAG: {
>      GstTagList *tags = NULL;
>
>      gst_message_parse_tag (msg, &amp;tags);
>      g_print ("Got tags from element %s\n", GST_OBJECT_NAME (msg->src));
>      handle_tags (tags);
>      gst_tag_list_unref (tags);
>      break;
>    }
>    ...
>  }
>  ...


MT safe.
-}
messageParseTag ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_TAG. -}
    -> m (Gst.TagList.TagList)
messageParseTag message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    tagList <- allocMem :: IO (Ptr (Ptr Gst.TagList.TagList))
    gst_message_parse_tag message' tagList
    tagList' <- peek tagList
    tagList'' <- (wrapBoxed Gst.TagList.TagList) tagList'
    touchManagedPtr message
    freeMem tagList
    return tagList''

#if ENABLE_OVERLOADING
data MessageParseTagMethodInfo
instance (signature ~ (m (Gst.TagList.TagList)), MonadIO m) => O.MethodInfo MessageParseTagMethodInfo Message signature where
    overloadedMethod _ = messageParseTag

#endif

-- method Message::parse_toc
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid #GstMessage of type GST_MESSAGE_TOC.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "toc", argType = TInterface (Name {namespace = "Gst", name = "Toc"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the TOC.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "updated", argType = TBasicType TBoolean, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the updated flag.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_toc" gst_message_parse_toc ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Toc.Toc) ->                -- toc : TInterface (Name {namespace = "Gst", name = "Toc"})
    Ptr CInt ->                             -- updated : TBasicType TBoolean
    IO ()

{- |
Extract the TOC from the 'GI.Gst.Structs.Message.Message'. The TOC returned in the
output argument is a copy; the caller must free it with
@/gst_toc_unref()/@ when done.

MT safe.
-}
messageParseToc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_TOC. -}
    -> m ((Gst.Toc.Toc, Bool))
messageParseToc message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    toc <- allocMem :: IO (Ptr (Ptr Gst.Toc.Toc))
    updated <- allocMem :: IO (Ptr CInt)
    gst_message_parse_toc message' toc updated
    toc' <- peek toc
    toc'' <- (wrapBoxed Gst.Toc.Toc) toc'
    updated' <- peek updated
    let updated'' = (/= 0) updated'
    touchManagedPtr message
    freeMem toc
    freeMem updated
    return (toc'', updated'')

#if ENABLE_OVERLOADING
data MessageParseTocMethodInfo
instance (signature ~ (m ((Gst.Toc.Toc, Bool))), MonadIO m) => O.MethodInfo MessageParseTocMethodInfo Message signature where
    overloadedMethod _ = messageParseToc

#endif

-- method Message::parse_warning
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_WARNING.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "gerror", argType = TError, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location for the GError", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "debug", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location for the debug message,\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_message_parse_warning" gst_message_parse_warning ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr GError) ->                     -- gerror : TError
    Ptr CString ->                          -- debug : TBasicType TUTF8
    IO ()

{- |
Extracts the GError and debug string from the GstMessage. The values returned
in the output arguments are copies; the caller must free them when done.

MT safe.
-}
messageParseWarning ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_WARNING. -}
    -> m ((GError, T.Text))
messageParseWarning message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    gerror <- allocMem :: IO (Ptr (Ptr GError))
    debug <- allocMem :: IO (Ptr CString)
    gst_message_parse_warning message' gerror debug
    gerror' <- peek gerror
    gerror'' <- (wrapBoxed GError) gerror'
    debug' <- peek debug
    debug'' <- cstringToText debug'
    freeMem debug'
    touchManagedPtr message
    freeMem gerror
    freeMem debug
    return (gerror'', debug'')

#if ENABLE_OVERLOADING
data MessageParseWarningMethodInfo
instance (signature ~ (m ((GError, T.Text))), MonadIO m) => O.MethodInfo MessageParseWarningMethodInfo Message signature where
    overloadedMethod _ = messageParseWarning

#endif

-- method Message::parse_warning_details
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The message object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "structure", argType = TInterface (Name {namespace = "Gst", name = "Structure"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A pointer to the returned details structure", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_parse_warning_details" gst_message_parse_warning_details ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr (Ptr Gst.Structure.Structure) ->    -- structure : TInterface (Name {namespace = "Gst", name = "Structure"})
    IO ()

{- |
Returns the optional details structure, may be NULL if none
The returned structure must not be freed.

/Since: 1.10/
-}
messageParseWarningDetails ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: The message object -}
    -> m (Gst.Structure.Structure)
messageParseWarningDetails message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    structure <- allocMem :: IO (Ptr (Ptr Gst.Structure.Structure))
    gst_message_parse_warning_details message' structure
    structure' <- peek structure
    structure'' <- (newBoxed Gst.Structure.Structure) structure'
    touchManagedPtr message
    freeMem structure
    return structure''

#if ENABLE_OVERLOADING
data MessageParseWarningDetailsMethodInfo
instance (signature ~ (m (Gst.Structure.Structure)), MonadIO m) => O.MethodInfo MessageParseWarningDetailsMethodInfo Message signature where
    overloadedMethod _ = messageParseWarningDetails

#endif

-- method Message::set_buffering_stats
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_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_message_set_buffering_stats" gst_message_set_buffering_stats ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    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 /@message@/.
-}
messageSetBufferingStats ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_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 ()
messageSetBufferingStats message mode avgIn avgOut bufferingLeft = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    let mode' = (fromIntegral . fromEnum) mode
    gst_message_set_buffering_stats message' mode' avgIn avgOut bufferingLeft
    touchManagedPtr message
    return ()

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

#endif

-- method Message::set_group_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_id", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the group id", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_set_group_id" gst_message_set_group_id ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Word32 ->                               -- group_id : TBasicType TUInt
    IO ()

{- |
Sets the group id on the stream-start message.

All streams that have the same group id are supposed to be played
together, i.e. all streams inside a container file should have the
same group id but different stream ids. The group id should change
each time the stream is started, resulting in different group ids
each time a file is played for example.

MT safe.

/Since: 1.2/
-}
messageSetGroupId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: the message -}
    -> Word32
    {- ^ /@groupId@/: the group id -}
    -> m ()
messageSetGroupId message groupId = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    gst_message_set_group_id message' groupId
    touchManagedPtr message
    return ()

#if ENABLE_OVERLOADING
data MessageSetGroupIdMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo MessageSetGroupIdMethodInfo Message signature where
    overloadedMethod _ = messageSetGroupId

#endif

-- method Message::set_qos_stats
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_QOS.", 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 "Units of the 'processed' and 'dropped' fields. Video sinks and video\nfilters will use GST_FORMAT_BUFFERS (frames). Audio sinks and audio filters\nwill likely use GST_FORMAT_DEFAULT (samples).", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "processed", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Total number of units correctly processed since the last state\nchange to READY or a flushing operation.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dropped", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Total number of units dropped since the last state change to READY\nor a flushing operation.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_set_qos_stats" gst_message_set_qos_stats ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    CUInt ->                                -- format : TInterface (Name {namespace = "Gst", name = "Format"})
    Word64 ->                               -- processed : TBasicType TUInt64
    Word64 ->                               -- dropped : TBasicType TUInt64
    IO ()

{- |
Set the QoS stats representing the history of the current continuous pipeline
playback period.

When /@format@/ is /@gSTFORMATUNDEFINED@/ both /@dropped@/ and /@processed@/ are
invalid. Values of -1 for either /@processed@/ or /@dropped@/ mean unknown values.

MT safe.
-}
messageSetQosStats ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_QOS. -}
    -> Gst.Enums.Format
    {- ^ /@format@/: Units of the \'processed\' and \'dropped\' fields. Video sinks and video
filters will use GST_FORMAT_BUFFERS (frames). Audio sinks and audio filters
will likely use GST_FORMAT_DEFAULT (samples). -}
    -> Word64
    {- ^ /@processed@/: Total number of units correctly processed since the last state
change to READY or a flushing operation. -}
    -> Word64
    {- ^ /@dropped@/: Total number of units dropped since the last state change to READY
or a flushing operation. -}
    -> m ()
messageSetQosStats message format processed dropped = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    let format' = (fromIntegral . fromEnum) format
    gst_message_set_qos_stats message' format' processed dropped
    touchManagedPtr message
    return ()

#if ENABLE_OVERLOADING
data MessageSetQosStatsMethodInfo
instance (signature ~ (Gst.Enums.Format -> Word64 -> Word64 -> m ()), MonadIO m) => O.MethodInfo MessageSetQosStatsMethodInfo Message signature where
    overloadedMethod _ = messageSetQosStats

#endif

-- method Message::set_qos_values
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_QOS.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "jitter", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The difference of the running-time against the deadline.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "proportion", argType = TBasicType TDouble, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Long term prediction of the ideal rate relative to normal rate\nto get optimal quality.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "quality", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "An element dependent integer value that specifies the current\nquality level of the element. The default maximum quality is 1000000.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_set_qos_values" gst_message_set_qos_values ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Int64 ->                                -- jitter : TBasicType TInt64
    CDouble ->                              -- proportion : TBasicType TDouble
    Int32 ->                                -- quality : TBasicType TInt
    IO ()

{- |
Set the QoS values that have been calculated\/analysed from the QoS data

MT safe.
-}
messageSetQosValues ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_QOS. -}
    -> Int64
    {- ^ /@jitter@/: The difference of the running-time against the deadline. -}
    -> Double
    {- ^ /@proportion@/: Long term prediction of the ideal rate relative to normal rate
to get optimal quality. -}
    -> Int32
    {- ^ /@quality@/: An element dependent integer value that specifies the current
quality level of the element. The default maximum quality is 1000000. -}
    -> m ()
messageSetQosValues message jitter proportion quality = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    let proportion' = realToFrac proportion
    gst_message_set_qos_values message' jitter proportion' quality
    touchManagedPtr message
    return ()

#if ENABLE_OVERLOADING
data MessageSetQosValuesMethodInfo
instance (signature ~ (Int64 -> Double -> Int32 -> m ()), MonadIO m) => O.MethodInfo MessageSetQosValuesMethodInfo Message signature where
    overloadedMethod _ = messageSetQosValues

#endif

-- method Message::set_seqnum
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstMessage.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "seqnum", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A sequence number.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_set_seqnum" gst_message_set_seqnum ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Word32 ->                               -- seqnum : TBasicType TUInt32
    IO ()

{- |
Set the sequence number of a message.

This function might be called by the creator of a message to indicate that
the message relates to other messages or events. See 'GI.Gst.Structs.Message.messageGetSeqnum'
for more information.

MT safe.
-}
messageSetSeqnum ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A 'GI.Gst.Structs.Message.Message'. -}
    -> Word32
    {- ^ /@seqnum@/: A sequence number. -}
    -> m ()
messageSetSeqnum message seqnum = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    gst_message_set_seqnum message' seqnum
    touchManagedPtr message
    return ()

#if ENABLE_OVERLOADING
data MessageSetSeqnumMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo MessageSetSeqnumMethodInfo Message signature where
    overloadedMethod _ = messageSetSeqnum

#endif

-- method Message::set_stream_status_object
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A valid #GstMessage of type GST_MESSAGE_STREAM_STATUS.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "object", argType = TInterface (Name {namespace = "GObject", name = "Value"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the object controlling the streaming", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_set_stream_status_object" gst_message_set_stream_status_object ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr GValue ->                           -- object : TInterface (Name {namespace = "GObject", name = "Value"})
    IO ()

{- |
Configures the object handling the streaming thread. This is usually a
GstTask object but other objects might be added in the future.
-}
messageSetStreamStatusObject ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: A valid 'GI.Gst.Structs.Message.Message' of type GST_MESSAGE_STREAM_STATUS. -}
    -> GValue
    {- ^ /@object@/: the object controlling the streaming -}
    -> m ()
messageSetStreamStatusObject message object = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    object' <- unsafeManagedPtrGetPtr object
    gst_message_set_stream_status_object message' object'
    touchManagedPtr message
    touchManagedPtr object
    return ()

#if ENABLE_OVERLOADING
data MessageSetStreamStatusObjectMethodInfo
instance (signature ~ (GValue -> m ()), MonadIO m) => O.MethodInfo MessageSetStreamStatusObjectMethodInfo Message signature where
    overloadedMethod _ = messageSetStreamStatusObject

#endif

-- method Message::streams_selected_add
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_STREAMS_SELECTED", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stream", argType = TInterface (Name {namespace = "Gst", name = "Stream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStream to add to @message", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_streams_selected_add" gst_message_streams_selected_add ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Ptr Gst.Stream.Stream ->                -- stream : TInterface (Name {namespace = "Gst", name = "Stream"})
    IO ()

{- |
Adds the /@stream@/ to the /@message@/.

/Since: 1.10/
-}
messageStreamsSelectedAdd ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Stream.IsStream a) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeStreamsSelected' -}
    -> a
    {- ^ /@stream@/: a 'GI.Gst.Objects.Stream.Stream' to add to /@message@/ -}
    -> m ()
messageStreamsSelectedAdd message stream = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    stream' <- unsafeManagedPtrCastPtr stream
    gst_message_streams_selected_add message' stream'
    touchManagedPtr message
    touchManagedPtr stream
    return ()

#if ENABLE_OVERLOADING
data MessageStreamsSelectedAddMethodInfo
instance (signature ~ (a -> m ()), MonadIO m, Gst.Stream.IsStream a) => O.MethodInfo MessageStreamsSelectedAddMethodInfo Message signature where
    overloadedMethod _ = messageStreamsSelectedAdd

#endif

-- method Message::streams_selected_get_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_STREAMS_SELECTED", 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_message_streams_selected_get_size" gst_message_streams_selected_get_size ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    IO Word32

{- |
Returns the number of streams contained in the /@message@/.

/Since: 1.10/
-}
messageStreamsSelectedGetSize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeStreamsSelected' -}
    -> m Word32
    {- ^ __Returns:__ The number of streams contained within. -}
messageStreamsSelectedGetSize message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    result <- gst_message_streams_selected_get_size message'
    touchManagedPtr message
    return result

#if ENABLE_OVERLOADING
data MessageStreamsSelectedGetSizeMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo MessageStreamsSelectedGetSizeMethodInfo Message signature where
    overloadedMethod _ = messageStreamsSelectedGetSize

#endif

-- method Message::streams_selected_get_stream
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstMessage of type %GST_MESSAGE_STREAMS_SELECTED", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "idx", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Index of the stream to retrieve", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Stream"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_message_streams_selected_get_stream" gst_message_streams_selected_get_stream ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    Word32 ->                               -- idx : TBasicType TUInt
    IO (Ptr Gst.Stream.Stream)

{- |
Retrieves the 'GI.Gst.Objects.Stream.Stream' with index /@index@/ from the /@message@/.

/Since: 1.10/
-}
messageStreamsSelectedGetStream ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: a 'GI.Gst.Structs.Message.Message' of type 'GI.Gst.Flags.MessageTypeStreamsSelected' -}
    -> Word32
    {- ^ /@idx@/: Index of the stream to retrieve -}
    -> m (Maybe Gst.Stream.Stream)
    {- ^ __Returns:__ A 'GI.Gst.Objects.Stream.Stream' -}
messageStreamsSelectedGetStream message idx = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    result <- gst_message_streams_selected_get_stream message' idx
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject Gst.Stream.Stream) result'
        return result''
    touchManagedPtr message
    return maybeResult

#if ENABLE_OVERLOADING
data MessageStreamsSelectedGetStreamMethodInfo
instance (signature ~ (Word32 -> m (Maybe Gst.Stream.Stream)), MonadIO m) => O.MethodInfo MessageStreamsSelectedGetStreamMethodInfo Message signature where
    overloadedMethod _ = messageStreamsSelectedGetStream

#endif

-- method Message::writable_structure
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "message", argType = TInterface (Name {namespace = "Gst", name = "Message"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstMessage.", 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_message_writable_structure" gst_message_writable_structure ::
    Ptr Message ->                          -- message : TInterface (Name {namespace = "Gst", name = "Message"})
    IO (Ptr Gst.Structure.Structure)

{- |
Get a writable version of the structure.

/Since: 1.14/
-}
messageWritableStructure ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Message
    {- ^ /@message@/: The 'GI.Gst.Structs.Message.Message'. -}
    -> m Gst.Structure.Structure
    {- ^ __Returns:__ The structure of the message. The structure
is still owned by the message, which means that you should not free
it and that the pointer becomes invalid when you free the message.
This function checks if /@message@/ is writable and will never return
'Nothing'.

MT safe. -}
messageWritableStructure message = liftIO $ do
    message' <- unsafeManagedPtrGetPtr message
    result <- gst_message_writable_structure message'
    checkUnexpectedReturnNULL "messageWritableStructure" result
    result' <- (newBoxed Gst.Structure.Structure) result
    touchManagedPtr message
    return result'

#if ENABLE_OVERLOADING
data MessageWritableStructureMethodInfo
instance (signature ~ (m Gst.Structure.Structure), MonadIO m) => O.MethodInfo MessageWritableStructureMethodInfo Message signature where
    overloadedMethod _ = messageWritableStructure

#endif

#if ENABLE_OVERLOADING
type family ResolveMessageMethod (t :: Symbol) (o :: *) :: * where
    ResolveMessageMethod "addRedirectEntry" o = MessageAddRedirectEntryMethodInfo
    ResolveMessageMethod "hasName" o = MessageHasNameMethodInfo
    ResolveMessageMethod "parseAsyncDone" o = MessageParseAsyncDoneMethodInfo
    ResolveMessageMethod "parseBuffering" o = MessageParseBufferingMethodInfo
    ResolveMessageMethod "parseBufferingStats" o = MessageParseBufferingStatsMethodInfo
    ResolveMessageMethod "parseClockLost" o = MessageParseClockLostMethodInfo
    ResolveMessageMethod "parseClockProvide" o = MessageParseClockProvideMethodInfo
    ResolveMessageMethod "parseContextType" o = MessageParseContextTypeMethodInfo
    ResolveMessageMethod "parseDeviceAdded" o = MessageParseDeviceAddedMethodInfo
    ResolveMessageMethod "parseDeviceRemoved" o = MessageParseDeviceRemovedMethodInfo
    ResolveMessageMethod "parseError" o = MessageParseErrorMethodInfo
    ResolveMessageMethod "parseErrorDetails" o = MessageParseErrorDetailsMethodInfo
    ResolveMessageMethod "parseGroupId" o = MessageParseGroupIdMethodInfo
    ResolveMessageMethod "parseHaveContext" o = MessageParseHaveContextMethodInfo
    ResolveMessageMethod "parseInfo" o = MessageParseInfoMethodInfo
    ResolveMessageMethod "parseInfoDetails" o = MessageParseInfoDetailsMethodInfo
    ResolveMessageMethod "parseNewClock" o = MessageParseNewClockMethodInfo
    ResolveMessageMethod "parseProgress" o = MessageParseProgressMethodInfo
    ResolveMessageMethod "parsePropertyNotify" o = MessageParsePropertyNotifyMethodInfo
    ResolveMessageMethod "parseQos" o = MessageParseQosMethodInfo
    ResolveMessageMethod "parseQosStats" o = MessageParseQosStatsMethodInfo
    ResolveMessageMethod "parseQosValues" o = MessageParseQosValuesMethodInfo
    ResolveMessageMethod "parseRedirectEntry" o = MessageParseRedirectEntryMethodInfo
    ResolveMessageMethod "parseRequestState" o = MessageParseRequestStateMethodInfo
    ResolveMessageMethod "parseResetTime" o = MessageParseResetTimeMethodInfo
    ResolveMessageMethod "parseSegmentDone" o = MessageParseSegmentDoneMethodInfo
    ResolveMessageMethod "parseSegmentStart" o = MessageParseSegmentStartMethodInfo
    ResolveMessageMethod "parseStateChanged" o = MessageParseStateChangedMethodInfo
    ResolveMessageMethod "parseStepDone" o = MessageParseStepDoneMethodInfo
    ResolveMessageMethod "parseStepStart" o = MessageParseStepStartMethodInfo
    ResolveMessageMethod "parseStreamCollection" o = MessageParseStreamCollectionMethodInfo
    ResolveMessageMethod "parseStreamStatus" o = MessageParseStreamStatusMethodInfo
    ResolveMessageMethod "parseStreamsSelected" o = MessageParseStreamsSelectedMethodInfo
    ResolveMessageMethod "parseStructureChange" o = MessageParseStructureChangeMethodInfo
    ResolveMessageMethod "parseTag" o = MessageParseTagMethodInfo
    ResolveMessageMethod "parseToc" o = MessageParseTocMethodInfo
    ResolveMessageMethod "parseWarning" o = MessageParseWarningMethodInfo
    ResolveMessageMethod "parseWarningDetails" o = MessageParseWarningDetailsMethodInfo
    ResolveMessageMethod "streamsSelectedAdd" o = MessageStreamsSelectedAddMethodInfo
    ResolveMessageMethod "streamsSelectedGetSize" o = MessageStreamsSelectedGetSizeMethodInfo
    ResolveMessageMethod "streamsSelectedGetStream" o = MessageStreamsSelectedGetStreamMethodInfo
    ResolveMessageMethod "writableStructure" o = MessageWritableStructureMethodInfo
    ResolveMessageMethod "getNumRedirectEntries" o = MessageGetNumRedirectEntriesMethodInfo
    ResolveMessageMethod "getSeqnum" o = MessageGetSeqnumMethodInfo
    ResolveMessageMethod "getStreamStatusObject" o = MessageGetStreamStatusObjectMethodInfo
    ResolveMessageMethod "getStructure" o = MessageGetStructureMethodInfo
    ResolveMessageMethod "setBufferingStats" o = MessageSetBufferingStatsMethodInfo
    ResolveMessageMethod "setGroupId" o = MessageSetGroupIdMethodInfo
    ResolveMessageMethod "setQosStats" o = MessageSetQosStatsMethodInfo
    ResolveMessageMethod "setQosValues" o = MessageSetQosValuesMethodInfo
    ResolveMessageMethod "setSeqnum" o = MessageSetSeqnumMethodInfo
    ResolveMessageMethod "setStreamStatusObject" o = MessageSetStreamStatusObjectMethodInfo
    ResolveMessageMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveMessageMethod t Message, O.MethodInfo info Message p) => O.IsLabelProxy t (Message -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveMessageMethod t Message, O.MethodInfo info Message p) => O.IsLabel t (Message -> 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

#endif