{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.GstVideo.Objects.VideoBufferPool
    ( 

-- * Exported types
    VideoBufferPool(..)                     ,
    IsVideoBufferPool                       ,
    toVideoBufferPool                       ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [acquireBuffer]("GI.Gst.Objects.BufferPool#g:method:acquireBuffer"), [addControlBinding]("GI.Gst.Objects.Object#g:method:addControlBinding"), [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [defaultError]("GI.Gst.Objects.Object#g:method:defaultError"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [hasActiveControlBindings]("GI.Gst.Objects.Object#g:method:hasActiveControlBindings"), [hasAncestor]("GI.Gst.Objects.Object#g:method:hasAncestor"), [hasAsAncestor]("GI.Gst.Objects.Object#g:method:hasAsAncestor"), [hasAsParent]("GI.Gst.Objects.Object#g:method:hasAsParent"), [hasOption]("GI.Gst.Objects.BufferPool#g:method:hasOption"), [isActive]("GI.Gst.Objects.BufferPool#g:method:isActive"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.Gst.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [releaseBuffer]("GI.Gst.Objects.BufferPool#g:method:releaseBuffer"), [removeControlBinding]("GI.Gst.Objects.Object#g:method:removeControlBinding"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [suggestNextSync]("GI.Gst.Objects.Object#g:method:suggestNextSync"), [syncValues]("GI.Gst.Objects.Object#g:method:syncValues"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unparent]("GI.Gst.Objects.Object#g:method:unparent"), [unref]("GI.Gst.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getConfig]("GI.Gst.Objects.BufferPool#g:method:getConfig"), [getControlBinding]("GI.Gst.Objects.Object#g:method:getControlBinding"), [getControlRate]("GI.Gst.Objects.Object#g:method:getControlRate"), [getData]("GI.GObject.Objects.Object#g:method:getData"), [getGValueArray]("GI.Gst.Objects.Object#g:method:getGValueArray"), [getName]("GI.Gst.Objects.Object#g:method:getName"), [getOptions]("GI.Gst.Objects.BufferPool#g:method:getOptions"), [getParent]("GI.Gst.Objects.Object#g:method:getParent"), [getPathString]("GI.Gst.Objects.Object#g:method:getPathString"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getValue]("GI.Gst.Objects.Object#g:method:getValue").
-- 
-- ==== Setters
-- [setActive]("GI.Gst.Objects.BufferPool#g:method:setActive"), [setConfig]("GI.Gst.Objects.BufferPool#g:method:setConfig"), [setControlBindingDisabled]("GI.Gst.Objects.Object#g:method:setControlBindingDisabled"), [setControlBindingsDisabled]("GI.Gst.Objects.Object#g:method:setControlBindingsDisabled"), [setControlRate]("GI.Gst.Objects.Object#g:method:setControlRate"), [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setFlushing]("GI.Gst.Objects.BufferPool#g:method:setFlushing"), [setName]("GI.Gst.Objects.Object#g:method:setName"), [setParent]("GI.Gst.Objects.Object#g:method:setParent"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveVideoBufferPoolMethod            ,
#endif

-- ** new #method:new#

    videoBufferPoolNew                      ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gst.Objects.BufferPool as Gst.BufferPool
import qualified GI.Gst.Objects.Object as Gst.Object

-- | Memory-managed wrapper type.
newtype VideoBufferPool = VideoBufferPool (SP.ManagedPtr VideoBufferPool)
    deriving (VideoBufferPool -> VideoBufferPool -> Bool
(VideoBufferPool -> VideoBufferPool -> Bool)
-> (VideoBufferPool -> VideoBufferPool -> Bool)
-> Eq VideoBufferPool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VideoBufferPool -> VideoBufferPool -> Bool
== :: VideoBufferPool -> VideoBufferPool -> Bool
$c/= :: VideoBufferPool -> VideoBufferPool -> Bool
/= :: VideoBufferPool -> VideoBufferPool -> Bool
Eq)

instance SP.ManagedPtrNewtype VideoBufferPool where
    toManagedPtr :: VideoBufferPool -> ManagedPtr VideoBufferPool
toManagedPtr (VideoBufferPool ManagedPtr VideoBufferPool
p) = ManagedPtr VideoBufferPool
p

foreign import ccall "gst_video_buffer_pool_get_type"
    c_gst_video_buffer_pool_get_type :: IO B.Types.GType

instance B.Types.TypedObject VideoBufferPool where
    glibType :: IO GType
glibType = IO GType
c_gst_video_buffer_pool_get_type

instance B.Types.GObject VideoBufferPool

-- | Type class for types which can be safely cast to `VideoBufferPool`, for instance with `toVideoBufferPool`.
class (SP.GObject o, O.IsDescendantOf VideoBufferPool o) => IsVideoBufferPool o
instance (SP.GObject o, O.IsDescendantOf VideoBufferPool o) => IsVideoBufferPool o

instance O.HasParentTypes VideoBufferPool
type instance O.ParentTypes VideoBufferPool = '[Gst.BufferPool.BufferPool, Gst.Object.Object, GObject.Object.Object]

-- | Cast to `VideoBufferPool`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toVideoBufferPool :: (MIO.MonadIO m, IsVideoBufferPool o) => o -> m VideoBufferPool
toVideoBufferPool :: forall (m :: * -> *) o.
(MonadIO m, IsVideoBufferPool o) =>
o -> m VideoBufferPool
toVideoBufferPool = IO VideoBufferPool -> m VideoBufferPool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO VideoBufferPool -> m VideoBufferPool)
-> (o -> IO VideoBufferPool) -> o -> m VideoBufferPool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr VideoBufferPool -> VideoBufferPool)
-> o -> IO VideoBufferPool
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr VideoBufferPool -> VideoBufferPool
VideoBufferPool

-- | Convert 'VideoBufferPool' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe VideoBufferPool) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gst_video_buffer_pool_get_type
    gvalueSet_ :: Ptr GValue -> Maybe VideoBufferPool -> IO ()
gvalueSet_ Ptr GValue
gv Maybe VideoBufferPool
P.Nothing = Ptr GValue -> Ptr VideoBufferPool -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr VideoBufferPool
forall a. Ptr a
FP.nullPtr :: FP.Ptr VideoBufferPool)
    gvalueSet_ Ptr GValue
gv (P.Just VideoBufferPool
obj) = VideoBufferPool -> (Ptr VideoBufferPool -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr VideoBufferPool
obj (Ptr GValue -> Ptr VideoBufferPool -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe VideoBufferPool)
gvalueGet_ Ptr GValue
gv = do
        Ptr VideoBufferPool
ptr <- Ptr GValue -> IO (Ptr VideoBufferPool)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr VideoBufferPool)
        if Ptr VideoBufferPool
ptr Ptr VideoBufferPool -> Ptr VideoBufferPool -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr VideoBufferPool
forall a. Ptr a
FP.nullPtr
        then VideoBufferPool -> Maybe VideoBufferPool
forall a. a -> Maybe a
P.Just (VideoBufferPool -> Maybe VideoBufferPool)
-> IO VideoBufferPool -> IO (Maybe VideoBufferPool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr VideoBufferPool -> VideoBufferPool)
-> Ptr VideoBufferPool -> IO VideoBufferPool
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr VideoBufferPool -> VideoBufferPool
VideoBufferPool Ptr VideoBufferPool
ptr
        else Maybe VideoBufferPool -> IO (Maybe VideoBufferPool)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe VideoBufferPool
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveVideoBufferPoolMethod (t :: Symbol) (o :: *) :: * where
    ResolveVideoBufferPoolMethod "acquireBuffer" o = Gst.BufferPool.BufferPoolAcquireBufferMethodInfo
    ResolveVideoBufferPoolMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
    ResolveVideoBufferPoolMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveVideoBufferPoolMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveVideoBufferPoolMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
    ResolveVideoBufferPoolMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveVideoBufferPoolMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveVideoBufferPoolMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveVideoBufferPoolMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
    ResolveVideoBufferPoolMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
    ResolveVideoBufferPoolMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
    ResolveVideoBufferPoolMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
    ResolveVideoBufferPoolMethod "hasOption" o = Gst.BufferPool.BufferPoolHasOptionMethodInfo
    ResolveVideoBufferPoolMethod "isActive" o = Gst.BufferPool.BufferPoolIsActiveMethodInfo
    ResolveVideoBufferPoolMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveVideoBufferPoolMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveVideoBufferPoolMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveVideoBufferPoolMethod "ref" o = Gst.Object.ObjectRefMethodInfo
    ResolveVideoBufferPoolMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveVideoBufferPoolMethod "releaseBuffer" o = Gst.BufferPool.BufferPoolReleaseBufferMethodInfo
    ResolveVideoBufferPoolMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
    ResolveVideoBufferPoolMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveVideoBufferPoolMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveVideoBufferPoolMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveVideoBufferPoolMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
    ResolveVideoBufferPoolMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
    ResolveVideoBufferPoolMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveVideoBufferPoolMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
    ResolveVideoBufferPoolMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
    ResolveVideoBufferPoolMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveVideoBufferPoolMethod "getConfig" o = Gst.BufferPool.BufferPoolGetConfigMethodInfo
    ResolveVideoBufferPoolMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
    ResolveVideoBufferPoolMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
    ResolveVideoBufferPoolMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveVideoBufferPoolMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
    ResolveVideoBufferPoolMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
    ResolveVideoBufferPoolMethod "getOptions" o = Gst.BufferPool.BufferPoolGetOptionsMethodInfo
    ResolveVideoBufferPoolMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
    ResolveVideoBufferPoolMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
    ResolveVideoBufferPoolMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveVideoBufferPoolMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveVideoBufferPoolMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
    ResolveVideoBufferPoolMethod "setActive" o = Gst.BufferPool.BufferPoolSetActiveMethodInfo
    ResolveVideoBufferPoolMethod "setConfig" o = Gst.BufferPool.BufferPoolSetConfigMethodInfo
    ResolveVideoBufferPoolMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
    ResolveVideoBufferPoolMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
    ResolveVideoBufferPoolMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
    ResolveVideoBufferPoolMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveVideoBufferPoolMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveVideoBufferPoolMethod "setFlushing" o = Gst.BufferPool.BufferPoolSetFlushingMethodInfo
    ResolveVideoBufferPoolMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
    ResolveVideoBufferPoolMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
    ResolveVideoBufferPoolMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveVideoBufferPoolMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveVideoBufferPoolMethod t VideoBufferPool, O.OverloadedMethod info VideoBufferPool p) => OL.IsLabel t (VideoBufferPool -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveVideoBufferPoolMethod t VideoBufferPool, O.OverloadedMethod info VideoBufferPool p, R.HasField t VideoBufferPool p) => R.HasField t VideoBufferPool p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveVideoBufferPoolMethod t VideoBufferPool, O.OverloadedMethodInfo info VideoBufferPool) => OL.IsLabel t (O.MethodProxy info VideoBufferPool) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList VideoBufferPool
type instance O.AttributeList VideoBufferPool = VideoBufferPoolAttributeList
type VideoBufferPoolAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList VideoBufferPool = VideoBufferPoolSignalList
type VideoBufferPoolSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

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

foreign import ccall "gst_video_buffer_pool_new" gst_video_buffer_pool_new :: 
    IO (Ptr VideoBufferPool)

-- | Create a new bufferpool that can allocate video frames. This bufferpool
-- supports all the video bufferpool options.
videoBufferPoolNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m VideoBufferPool
    -- ^ __Returns:__ a new t'GI.Gst.Objects.BufferPool.BufferPool' to allocate video frames
videoBufferPoolNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m VideoBufferPool
videoBufferPoolNew  = IO VideoBufferPool -> m VideoBufferPool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO VideoBufferPool -> m VideoBufferPool)
-> IO VideoBufferPool -> m VideoBufferPool
forall a b. (a -> b) -> a -> b
$ do
    Ptr VideoBufferPool
result <- IO (Ptr VideoBufferPool)
gst_video_buffer_pool_new
    Text -> Ptr VideoBufferPool -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"videoBufferPoolNew" Ptr VideoBufferPool
result
    VideoBufferPool
result' <- ((ManagedPtr VideoBufferPool -> VideoBufferPool)
-> Ptr VideoBufferPool -> IO VideoBufferPool
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr VideoBufferPool -> VideoBufferPool
VideoBufferPool) Ptr VideoBufferPool
result
    VideoBufferPool -> IO VideoBufferPool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return VideoBufferPool
result'

#if defined(ENABLE_OVERLOADING)
#endif