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

/No description available in the introspection data./
-}

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

module GI.Gst.Structs.TocEntry
    (

-- * Exported types
    TocEntry(..)                            ,
    noTocEntry                              ,


 -- * Methods
-- ** appendSubEntry #method:appendSubEntry#

#if ENABLE_OVERLOADING
    TocEntryAppendSubEntryMethodInfo        ,
#endif
    tocEntryAppendSubEntry                  ,


-- ** getEntryType #method:getEntryType#

#if ENABLE_OVERLOADING
    TocEntryGetEntryTypeMethodInfo          ,
#endif
    tocEntryGetEntryType                    ,


-- ** getLoop #method:getLoop#

#if ENABLE_OVERLOADING
    TocEntryGetLoopMethodInfo               ,
#endif
    tocEntryGetLoop                         ,


-- ** getParent #method:getParent#

#if ENABLE_OVERLOADING
    TocEntryGetParentMethodInfo             ,
#endif
    tocEntryGetParent                       ,


-- ** getStartStopTimes #method:getStartStopTimes#

#if ENABLE_OVERLOADING
    TocEntryGetStartStopTimesMethodInfo     ,
#endif
    tocEntryGetStartStopTimes               ,


-- ** getSubEntries #method:getSubEntries#

#if ENABLE_OVERLOADING
    TocEntryGetSubEntriesMethodInfo         ,
#endif
    tocEntryGetSubEntries                   ,


-- ** getTags #method:getTags#

#if ENABLE_OVERLOADING
    TocEntryGetTagsMethodInfo               ,
#endif
    tocEntryGetTags                         ,


-- ** getToc #method:getToc#

#if ENABLE_OVERLOADING
    TocEntryGetTocMethodInfo                ,
#endif
    tocEntryGetToc                          ,


-- ** getUid #method:getUid#

#if ENABLE_OVERLOADING
    TocEntryGetUidMethodInfo                ,
#endif
    tocEntryGetUid                          ,


-- ** isAlternative #method:isAlternative#

#if ENABLE_OVERLOADING
    TocEntryIsAlternativeMethodInfo         ,
#endif
    tocEntryIsAlternative                   ,


-- ** isSequence #method:isSequence#

#if ENABLE_OVERLOADING
    TocEntryIsSequenceMethodInfo            ,
#endif
    tocEntryIsSequence                      ,


-- ** mergeTags #method:mergeTags#

#if ENABLE_OVERLOADING
    TocEntryMergeTagsMethodInfo             ,
#endif
    tocEntryMergeTags                       ,


-- ** new #method:new#

    tocEntryNew                             ,


-- ** setLoop #method:setLoop#

#if ENABLE_OVERLOADING
    TocEntrySetLoopMethodInfo               ,
#endif
    tocEntrySetLoop                         ,


-- ** setStartStopTimes #method:setStartStopTimes#

#if ENABLE_OVERLOADING
    TocEntrySetStartStopTimesMethodInfo     ,
#endif
    tocEntrySetStartStopTimes               ,


-- ** setTags #method:setTags#

#if ENABLE_OVERLOADING
    TocEntrySetTagsMethodInfo               ,
#endif
    tocEntrySetTags                         ,




    ) 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.Structs.TagList as Gst.TagList
import {-# SOURCE #-} qualified GI.Gst.Structs.Toc as Gst.Toc

-- | Memory-managed wrapper type.
newtype TocEntry = TocEntry (ManagedPtr TocEntry)
foreign import ccall "gst_toc_entry_get_type" c_gst_toc_entry_get_type ::
    IO GType

instance BoxedObject TocEntry where
    boxedType _ = c_gst_toc_entry_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `TocEntry`.
noTocEntry :: Maybe TocEntry
noTocEntry = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList TocEntry
type instance O.AttributeList TocEntry = TocEntryAttributeList
type TocEntryAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method TocEntry::new
-- method type : Constructor
-- Args : [Arg {argCName = "type", argType = TInterface (Name {namespace = "Gst", name = "TocEntryType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "entry type.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uid", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "unique ID (UID) in the whole TOC.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "TocEntry"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_toc_entry_new" gst_toc_entry_new ::
    CUInt ->                                -- type : TInterface (Name {namespace = "Gst", name = "TocEntryType"})
    CString ->                              -- uid : TBasicType TUTF8
    IO (Ptr TocEntry)

{- |
Create new 'GI.Gst.Structs.TocEntry.TocEntry' structure.
-}
tocEntryNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Enums.TocEntryType
    {- ^ /@type@/: entry type. -}
    -> T.Text
    {- ^ /@uid@/: unique ID (UID) in the whole TOC. -}
    -> m TocEntry
    {- ^ __Returns:__ newly allocated 'GI.Gst.Structs.TocEntry.TocEntry' structure, free it with @/gst_toc_entry_unref()/@. -}
tocEntryNew type_ uid = liftIO $ do
    let type_' = (fromIntegral . fromEnum) type_
    uid' <- textToCString uid
    result <- gst_toc_entry_new type_' uid'
    checkUnexpectedReturnNULL "tocEntryNew" result
    result' <- (wrapBoxed TocEntry) result
    freeMem uid'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method TocEntry::append_sub_entry
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTocEntry instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "subentry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTocEntry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_toc_entry_append_sub_entry" gst_toc_entry_append_sub_entry ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    Ptr TocEntry ->                         -- subentry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    IO ()

{- |
Appends the 'GI.Gst.Structs.TocEntry.TocEntry' /@subentry@/ to /@entry@/.
-}
tocEntryAppendSubEntry ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: A 'GI.Gst.Structs.TocEntry.TocEntry' instance -}
    -> TocEntry
    {- ^ /@subentry@/: A 'GI.Gst.Structs.TocEntry.TocEntry' -}
    -> m ()
tocEntryAppendSubEntry entry subentry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    subentry' <- B.ManagedPtr.disownBoxed subentry
    gst_toc_entry_append_sub_entry entry' subentry'
    touchManagedPtr entry
    touchManagedPtr subentry
    return ()

#if ENABLE_OVERLOADING
data TocEntryAppendSubEntryMethodInfo
instance (signature ~ (TocEntry -> m ()), MonadIO m) => O.MethodInfo TocEntryAppendSubEntryMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryAppendSubEntry

#endif

-- method TocEntry::get_entry_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstTocEntry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "TocEntryType"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_toc_entry_get_entry_type" gst_toc_entry_get_entry_type ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    IO CUInt

{- |
/No description available in the introspection data./
-}
tocEntryGetEntryType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: a 'GI.Gst.Structs.TocEntry.TocEntry' -}
    -> m Gst.Enums.TocEntryType
    {- ^ __Returns:__ /@entry@/\'s entry type -}
tocEntryGetEntryType entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- gst_toc_entry_get_entry_type entry'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr entry
    return result'

#if ENABLE_OVERLOADING
data TocEntryGetEntryTypeMethodInfo
instance (signature ~ (m Gst.Enums.TocEntryType), MonadIO m) => O.MethodInfo TocEntryGetEntryTypeMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryGetEntryType

#endif

-- method TocEntry::get_loop
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstTocEntry to get values from.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "loop_type", argType = TInterface (Name {namespace = "Gst", name = "TocLoopType"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the loop_type\n            value, leave %NULL if not need.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "repeat_count", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the repeat_count\n               value, leave %NULL if not need.", 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_toc_entry_get_loop" gst_toc_entry_get_loop ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    Ptr CUInt ->                            -- loop_type : TInterface (Name {namespace = "Gst", name = "TocLoopType"})
    Ptr Int32 ->                            -- repeat_count : TBasicType TInt
    IO CInt

{- |
Get /@loopType@/ and /@repeatCount@/ values from the /@entry@/ and write them into
appropriate storages. Loops are e.g. used by sampled instruments. GStreamer
is not automatically applying the loop. The application can process this
meta data and use it e.g. to send a seek-event to loop a section.

/Since: 1.4/
-}
tocEntryGetLoop ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: 'GI.Gst.Structs.TocEntry.TocEntry' to get values from. -}
    -> m ((Bool, Gst.Enums.TocLoopType, Int32))
    {- ^ __Returns:__ 'True' if all non-'Nothing' storage pointers were filled with appropriate
values, 'False' otherwise. -}
tocEntryGetLoop entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    loopType <- allocMem :: IO (Ptr CUInt)
    repeatCount <- allocMem :: IO (Ptr Int32)
    result <- gst_toc_entry_get_loop entry' loopType repeatCount
    let result' = (/= 0) result
    loopType' <- peek loopType
    let loopType'' = (toEnum . fromIntegral) loopType'
    repeatCount' <- peek repeatCount
    touchManagedPtr entry
    freeMem loopType
    freeMem repeatCount
    return (result', loopType'', repeatCount')

#if ENABLE_OVERLOADING
data TocEntryGetLoopMethodInfo
instance (signature ~ (m ((Bool, Gst.Enums.TocLoopType, Int32))), MonadIO m) => O.MethodInfo TocEntryGetLoopMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryGetLoop

#endif

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

foreign import ccall "gst_toc_entry_get_parent" gst_toc_entry_get_parent ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    IO (Ptr TocEntry)

{- |
Gets the parent 'GI.Gst.Structs.TocEntry.TocEntry' of /@entry@/.
-}
tocEntryGetParent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: A 'GI.Gst.Structs.TocEntry.TocEntry' instance -}
    -> m (Maybe TocEntry)
    {- ^ __Returns:__ The parent 'GI.Gst.Structs.TocEntry.TocEntry' of /@entry@/ -}
tocEntryGetParent entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- gst_toc_entry_get_parent entry'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed TocEntry) result'
        return result''
    touchManagedPtr entry
    return maybeResult

#if ENABLE_OVERLOADING
data TocEntryGetParentMethodInfo
instance (signature ~ (m (Maybe TocEntry)), MonadIO m) => O.MethodInfo TocEntryGetParentMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryGetParent

#endif

-- method TocEntry::get_start_stop_times
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstTocEntry to get values from.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the start value, leave\n  %NULL if not need.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "stop", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the storage for the stop value, leave\n  %NULL if not need.", 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_toc_entry_get_start_stop_times" gst_toc_entry_get_start_stop_times ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    Ptr Int64 ->                            -- start : TBasicType TInt64
    Ptr Int64 ->                            -- stop : TBasicType TInt64
    IO CInt

{- |
Get /@start@/ and /@stop@/ values from the /@entry@/ and write them into appropriate
storages.
-}
tocEntryGetStartStopTimes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: 'GI.Gst.Structs.TocEntry.TocEntry' to get values from. -}
    -> m ((Bool, Int64, Int64))
    {- ^ __Returns:__ 'True' if all non-'Nothing' storage pointers were filled with appropriate
values, 'False' otherwise. -}
tocEntryGetStartStopTimes entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    start <- allocMem :: IO (Ptr Int64)
    stop <- allocMem :: IO (Ptr Int64)
    result <- gst_toc_entry_get_start_stop_times entry' start stop
    let result' = (/= 0) result
    start' <- peek start
    stop' <- peek stop
    touchManagedPtr entry
    freeMem start
    freeMem stop
    return (result', start', stop')

#if ENABLE_OVERLOADING
data TocEntryGetStartStopTimesMethodInfo
instance (signature ~ (m ((Bool, Int64, Int64))), MonadIO m) => O.MethodInfo TocEntryGetStartStopTimesMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryGetStartStopTimes

#endif

-- method TocEntry::get_sub_entries
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTocEntry instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gst", name = "TocEntry"})))
-- throws : False
-- Skip return : False

foreign import ccall "gst_toc_entry_get_sub_entries" gst_toc_entry_get_sub_entries ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    IO (Ptr (GList (Ptr TocEntry)))

{- |
Gets the sub-entries of /@entry@/.
-}
tocEntryGetSubEntries ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: A 'GI.Gst.Structs.TocEntry.TocEntry' instance -}
    -> m [TocEntry]
    {- ^ __Returns:__ A 'GI.GLib.Structs.List.List' of 'GI.Gst.Structs.TocEntry.TocEntry' of /@entry@/ -}
tocEntryGetSubEntries entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- gst_toc_entry_get_sub_entries entry'
    result' <- unpackGList result
    result'' <- mapM (newBoxed TocEntry) result'
    touchManagedPtr entry
    return result''

#if ENABLE_OVERLOADING
data TocEntryGetSubEntriesMethodInfo
instance (signature ~ (m [TocEntry]), MonadIO m) => O.MethodInfo TocEntryGetSubEntriesMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryGetSubEntries

#endif

-- method TocEntry::get_tags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTocEntry instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "TagList"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_toc_entry_get_tags" gst_toc_entry_get_tags ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    IO (Ptr Gst.TagList.TagList)

{- |
Gets the tags for /@entry@/.
-}
tocEntryGetTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: A 'GI.Gst.Structs.TocEntry.TocEntry' instance -}
    -> m Gst.TagList.TagList
    {- ^ __Returns:__ A 'GI.Gst.Structs.TagList.TagList' for /@entry@/ -}
tocEntryGetTags entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- gst_toc_entry_get_tags entry'
    checkUnexpectedReturnNULL "tocEntryGetTags" result
    result' <- (newBoxed Gst.TagList.TagList) result
    touchManagedPtr entry
    return result'

#if ENABLE_OVERLOADING
data TocEntryGetTagsMethodInfo
instance (signature ~ (m Gst.TagList.TagList), MonadIO m) => O.MethodInfo TocEntryGetTagsMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryGetTags

#endif

-- method TocEntry::get_toc
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTocEntry instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Toc"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_toc_entry_get_toc" gst_toc_entry_get_toc ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    IO (Ptr Gst.Toc.Toc)

{- |
Gets the parent 'GI.Gst.Structs.Toc.Toc' of /@entry@/.
-}
tocEntryGetToc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: A 'GI.Gst.Structs.TocEntry.TocEntry' instance -}
    -> m Gst.Toc.Toc
    {- ^ __Returns:__ The parent 'GI.Gst.Structs.Toc.Toc' of /@entry@/ -}
tocEntryGetToc entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- gst_toc_entry_get_toc entry'
    checkUnexpectedReturnNULL "tocEntryGetToc" result
    result' <- (newBoxed Gst.Toc.Toc) result
    touchManagedPtr entry
    return result'

#if ENABLE_OVERLOADING
data TocEntryGetTocMethodInfo
instance (signature ~ (m Gst.Toc.Toc), MonadIO m) => O.MethodInfo TocEntryGetTocMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryGetToc

#endif

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

foreign import ccall "gst_toc_entry_get_uid" gst_toc_entry_get_uid ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    IO CString

{- |
Gets the UID of /@entry@/.
-}
tocEntryGetUid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: A 'GI.Gst.Structs.TocEntry.TocEntry' instance -}
    -> m T.Text
    {- ^ __Returns:__ The UID of /@entry@/ -}
tocEntryGetUid entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- gst_toc_entry_get_uid entry'
    checkUnexpectedReturnNULL "tocEntryGetUid" result
    result' <- cstringToText result
    touchManagedPtr entry
    return result'

#if ENABLE_OVERLOADING
data TocEntryGetUidMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo TocEntryGetUidMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryGetUid

#endif

-- method TocEntry::is_alternative
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstTocEntry", 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_toc_entry_is_alternative" gst_toc_entry_is_alternative ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    IO CInt

{- |
/No description available in the introspection data./
-}
tocEntryIsAlternative ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: a 'GI.Gst.Structs.TocEntry.TocEntry' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@entry@/\'s type is an alternative type, otherwise 'False' -}
tocEntryIsAlternative entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- gst_toc_entry_is_alternative entry'
    let result' = (/= 0) result
    touchManagedPtr entry
    return result'

#if ENABLE_OVERLOADING
data TocEntryIsAlternativeMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo TocEntryIsAlternativeMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryIsAlternative

#endif

-- method TocEntry::is_sequence
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstTocEntry", 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_toc_entry_is_sequence" gst_toc_entry_is_sequence ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    IO CInt

{- |
/No description available in the introspection data./
-}
tocEntryIsSequence ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: a 'GI.Gst.Structs.TocEntry.TocEntry' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@entry@/\'s type is a sequence type, otherwise 'False' -}
tocEntryIsSequence entry = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    result <- gst_toc_entry_is_sequence entry'
    let result' = (/= 0) result
    touchManagedPtr entry
    return result'

#if ENABLE_OVERLOADING
data TocEntryIsSequenceMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo TocEntryIsSequenceMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryIsSequence

#endif

-- method TocEntry::merge_tags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTocEntry instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tags", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GstTagList or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "mode", argType = TInterface (Name {namespace = "Gst", name = "TagMergeMode"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTagMergeMode", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_toc_entry_merge_tags" gst_toc_entry_merge_tags ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    Ptr Gst.TagList.TagList ->              -- tags : TInterface (Name {namespace = "Gst", name = "TagList"})
    CUInt ->                                -- mode : TInterface (Name {namespace = "Gst", name = "TagMergeMode"})
    IO ()

{- |
Merge /@tags@/ into the existing tags of /@entry@/ using /@mode@/.
-}
tocEntryMergeTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: A 'GI.Gst.Structs.TocEntry.TocEntry' instance -}
    -> Maybe (Gst.TagList.TagList)
    {- ^ /@tags@/: A 'GI.Gst.Structs.TagList.TagList' or 'Nothing' -}
    -> Gst.Enums.TagMergeMode
    {- ^ /@mode@/: A 'GI.Gst.Enums.TagMergeMode' -}
    -> m ()
tocEntryMergeTags entry tags mode = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    maybeTags <- case tags of
        Nothing -> return nullPtr
        Just jTags -> do
            jTags' <- unsafeManagedPtrGetPtr jTags
            return jTags'
    let mode' = (fromIntegral . fromEnum) mode
    gst_toc_entry_merge_tags entry' maybeTags mode'
    touchManagedPtr entry
    whenJust tags touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data TocEntryMergeTagsMethodInfo
instance (signature ~ (Maybe (Gst.TagList.TagList) -> Gst.Enums.TagMergeMode -> m ()), MonadIO m) => O.MethodInfo TocEntryMergeTagsMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntryMergeTags

#endif

-- method TocEntry::set_loop
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstTocEntry to set values.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "loop_type", argType = TInterface (Name {namespace = "Gst", name = "TocLoopType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "loop_type value to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "repeat_count", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "repeat_count value to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_toc_entry_set_loop" gst_toc_entry_set_loop ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    CUInt ->                                -- loop_type : TInterface (Name {namespace = "Gst", name = "TocLoopType"})
    Int32 ->                                -- repeat_count : TBasicType TInt
    IO ()

{- |
Set /@loopType@/ and /@repeatCount@/ values for the /@entry@/.

/Since: 1.4/
-}
tocEntrySetLoop ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: 'GI.Gst.Structs.TocEntry.TocEntry' to set values. -}
    -> Gst.Enums.TocLoopType
    {- ^ /@loopType@/: loop_type value to set. -}
    -> Int32
    {- ^ /@repeatCount@/: repeat_count value to set. -}
    -> m ()
tocEntrySetLoop entry loopType repeatCount = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    let loopType' = (fromIntegral . fromEnum) loopType
    gst_toc_entry_set_loop entry' loopType' repeatCount
    touchManagedPtr entry
    return ()

#if ENABLE_OVERLOADING
data TocEntrySetLoopMethodInfo
instance (signature ~ (Gst.Enums.TocLoopType -> Int32 -> m ()), MonadIO m) => O.MethodInfo TocEntrySetLoopMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntrySetLoop

#endif

-- method TocEntry::set_start_stop_times
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstTocEntry to set values.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "start value to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "stop", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "stop value to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_toc_entry_set_start_stop_times" gst_toc_entry_set_start_stop_times ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    Int64 ->                                -- start : TBasicType TInt64
    Int64 ->                                -- stop : TBasicType TInt64
    IO ()

{- |
Set /@start@/ and /@stop@/ values for the /@entry@/.
-}
tocEntrySetStartStopTimes ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: 'GI.Gst.Structs.TocEntry.TocEntry' to set values. -}
    -> Int64
    {- ^ /@start@/: start value to set. -}
    -> Int64
    {- ^ /@stop@/: stop value to set. -}
    -> m ()
tocEntrySetStartStopTimes entry start stop = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    gst_toc_entry_set_start_stop_times entry' start stop
    touchManagedPtr entry
    return ()

#if ENABLE_OVERLOADING
data TocEntrySetStartStopTimesMethodInfo
instance (signature ~ (Int64 -> Int64 -> m ()), MonadIO m) => O.MethodInfo TocEntrySetStartStopTimesMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntrySetStartStopTimes

#endif

-- method TocEntry::set_tags
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "entry", argType = TInterface (Name {namespace = "Gst", name = "TocEntry"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #GstTocEntry instance", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tags", argType = TInterface (Name {namespace = "Gst", name = "TagList"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GstTagList 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_toc_entry_set_tags" gst_toc_entry_set_tags ::
    Ptr TocEntry ->                         -- entry : TInterface (Name {namespace = "Gst", name = "TocEntry"})
    Ptr Gst.TagList.TagList ->              -- tags : TInterface (Name {namespace = "Gst", name = "TagList"})
    IO ()

{- |
Set a 'GI.Gst.Structs.TagList.TagList' with tags for the complete /@entry@/.
-}
tocEntrySetTags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TocEntry
    {- ^ /@entry@/: A 'GI.Gst.Structs.TocEntry.TocEntry' instance -}
    -> Maybe (Gst.TagList.TagList)
    {- ^ /@tags@/: A 'GI.Gst.Structs.TagList.TagList' or 'Nothing' -}
    -> m ()
tocEntrySetTags entry tags = liftIO $ do
    entry' <- unsafeManagedPtrGetPtr entry
    maybeTags <- case tags of
        Nothing -> return nullPtr
        Just jTags -> do
            jTags' <- B.ManagedPtr.disownBoxed jTags
            return jTags'
    gst_toc_entry_set_tags entry' maybeTags
    touchManagedPtr entry
    whenJust tags touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data TocEntrySetTagsMethodInfo
instance (signature ~ (Maybe (Gst.TagList.TagList) -> m ()), MonadIO m) => O.MethodInfo TocEntrySetTagsMethodInfo TocEntry signature where
    overloadedMethod _ = tocEntrySetTags

#endif

#if ENABLE_OVERLOADING
type family ResolveTocEntryMethod (t :: Symbol) (o :: *) :: * where
    ResolveTocEntryMethod "appendSubEntry" o = TocEntryAppendSubEntryMethodInfo
    ResolveTocEntryMethod "isAlternative" o = TocEntryIsAlternativeMethodInfo
    ResolveTocEntryMethod "isSequence" o = TocEntryIsSequenceMethodInfo
    ResolveTocEntryMethod "mergeTags" o = TocEntryMergeTagsMethodInfo
    ResolveTocEntryMethod "getEntryType" o = TocEntryGetEntryTypeMethodInfo
    ResolveTocEntryMethod "getLoop" o = TocEntryGetLoopMethodInfo
    ResolveTocEntryMethod "getParent" o = TocEntryGetParentMethodInfo
    ResolveTocEntryMethod "getStartStopTimes" o = TocEntryGetStartStopTimesMethodInfo
    ResolveTocEntryMethod "getSubEntries" o = TocEntryGetSubEntriesMethodInfo
    ResolveTocEntryMethod "getTags" o = TocEntryGetTagsMethodInfo
    ResolveTocEntryMethod "getToc" o = TocEntryGetTocMethodInfo
    ResolveTocEntryMethod "getUid" o = TocEntryGetUidMethodInfo
    ResolveTocEntryMethod "setLoop" o = TocEntrySetLoopMethodInfo
    ResolveTocEntryMethod "setStartStopTimes" o = TocEntrySetStartStopTimesMethodInfo
    ResolveTocEntryMethod "setTags" o = TocEntrySetTagsMethodInfo
    ResolveTocEntryMethod l o = O.MethodResolutionFailed l o

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

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