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

'GI.GstBase.Objects.DataQueue.DataQueue' is an object that handles threadsafe queueing of objects. It
also provides size-related functionality. This object should be used for
any 'GI.Gst.Objects.Element.Element' that wishes to provide some sort of queueing functionality.
-}

module GI.GstBase.Objects.DataQueue
    ( 

-- * Exported types
    DataQueue(..)                           ,
    IsDataQueue                             ,
    toDataQueue                             ,
    noDataQueue                             ,


 -- * Properties
-- ** currentLevelBytes #attr:currentLevelBytes#
    DataQueueCurrentLevelBytesPropertyInfo  ,
    dataQueueCurrentLevelBytes              ,
    getDataQueueCurrentLevelBytes           ,


-- ** currentLevelTime #attr:currentLevelTime#
    DataQueueCurrentLevelTimePropertyInfo   ,
    dataQueueCurrentLevelTime               ,
    getDataQueueCurrentLevelTime            ,


-- ** currentLevelVisible #attr:currentLevelVisible#
    DataQueueCurrentLevelVisiblePropertyInfo,
    dataQueueCurrentLevelVisible            ,
    getDataQueueCurrentLevelVisible         ,




    ) 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.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 qualified GI.GObject.Objects.Object as GObject.Object

newtype DataQueue = DataQueue (ManagedPtr DataQueue)
foreign import ccall "gst_data_queue_get_type"
    c_gst_data_queue_get_type :: IO GType

instance GObject DataQueue where
    gobjectType _ = c_gst_data_queue_get_type
    

class GObject o => IsDataQueue o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError DataQueue a) =>
    IsDataQueue a
#endif
instance IsDataQueue DataQueue
instance GObject.Object.IsObject DataQueue

toDataQueue :: IsDataQueue o => o -> IO DataQueue
toDataQueue = unsafeCastTo DataQueue

noDataQueue :: Maybe DataQueue
noDataQueue = Nothing

type family ResolveDataQueueMethod (t :: Symbol) (o :: *) :: * where
    ResolveDataQueueMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDataQueueMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDataQueueMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDataQueueMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDataQueueMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDataQueueMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDataQueueMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDataQueueMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDataQueueMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDataQueueMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDataQueueMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveDataQueueMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDataQueueMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDataQueueMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDataQueueMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDataQueueMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDataQueueMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDataQueueMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDataQueueMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDataQueueMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDataQueueMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDataQueueMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDataQueueMethod l o = O.MethodResolutionFailed l o

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

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDataQueueMethod t DataQueue, O.MethodInfo info DataQueue p) => O.IsLabel t (DataQueue -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- VVV Prop "current-level-bytes"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getDataQueueCurrentLevelBytes :: (MonadIO m, IsDataQueue o) => o -> m Word32
getDataQueueCurrentLevelBytes obj = liftIO $ getObjectPropertyUInt32 obj "current-level-bytes"

data DataQueueCurrentLevelBytesPropertyInfo
instance AttrInfo DataQueueCurrentLevelBytesPropertyInfo where
    type AttrAllowedOps DataQueueCurrentLevelBytesPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DataQueueCurrentLevelBytesPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DataQueueCurrentLevelBytesPropertyInfo = IsDataQueue
    type AttrGetType DataQueueCurrentLevelBytesPropertyInfo = Word32
    type AttrLabel DataQueueCurrentLevelBytesPropertyInfo = "current-level-bytes"
    type AttrOrigin DataQueueCurrentLevelBytesPropertyInfo = DataQueue
    attrGet _ = getDataQueueCurrentLevelBytes
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "current-level-time"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getDataQueueCurrentLevelTime :: (MonadIO m, IsDataQueue o) => o -> m Word64
getDataQueueCurrentLevelTime obj = liftIO $ getObjectPropertyUInt64 obj "current-level-time"

data DataQueueCurrentLevelTimePropertyInfo
instance AttrInfo DataQueueCurrentLevelTimePropertyInfo where
    type AttrAllowedOps DataQueueCurrentLevelTimePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DataQueueCurrentLevelTimePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DataQueueCurrentLevelTimePropertyInfo = IsDataQueue
    type AttrGetType DataQueueCurrentLevelTimePropertyInfo = Word64
    type AttrLabel DataQueueCurrentLevelTimePropertyInfo = "current-level-time"
    type AttrOrigin DataQueueCurrentLevelTimePropertyInfo = DataQueue
    attrGet _ = getDataQueueCurrentLevelTime
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "current-level-visible"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getDataQueueCurrentLevelVisible :: (MonadIO m, IsDataQueue o) => o -> m Word32
getDataQueueCurrentLevelVisible obj = liftIO $ getObjectPropertyUInt32 obj "current-level-visible"

data DataQueueCurrentLevelVisiblePropertyInfo
instance AttrInfo DataQueueCurrentLevelVisiblePropertyInfo where
    type AttrAllowedOps DataQueueCurrentLevelVisiblePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DataQueueCurrentLevelVisiblePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DataQueueCurrentLevelVisiblePropertyInfo = IsDataQueue
    type AttrGetType DataQueueCurrentLevelVisiblePropertyInfo = Word32
    type AttrLabel DataQueueCurrentLevelVisiblePropertyInfo = "current-level-visible"
    type AttrOrigin DataQueueCurrentLevelVisiblePropertyInfo = DataQueue
    attrGet _ = getDataQueueCurrentLevelVisible
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList DataQueue
type instance O.AttributeList DataQueue = DataQueueAttributeList
type DataQueueAttributeList = ('[ '("currentLevelBytes", DataQueueCurrentLevelBytesPropertyInfo), '("currentLevelTime", DataQueueCurrentLevelTimePropertyInfo), '("currentLevelVisible", DataQueueCurrentLevelVisiblePropertyInfo)] :: [(Symbol, *)])

dataQueueCurrentLevelBytes :: AttrLabelProxy "currentLevelBytes"
dataQueueCurrentLevelBytes = AttrLabelProxy

dataQueueCurrentLevelTime :: AttrLabelProxy "currentLevelTime"
dataQueueCurrentLevelTime = AttrLabelProxy

dataQueueCurrentLevelVisible :: AttrLabelProxy "currentLevelVisible"
dataQueueCurrentLevelVisible = AttrLabelProxy

type instance O.SignalList DataQueue = DataQueueSignalList
type DataQueueSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])