{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- 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
-- ** Overloaded methods #method:Overloaded methods#

#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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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 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
/= :: VideoBufferPool -> VideoBufferPool -> Bool
$c/= :: VideoBufferPool -> VideoBufferPool -> Bool
== :: VideoBufferPool -> VideoBufferPool -> Bool
$c== :: 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

-- | Convert 'VideoBufferPool' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue VideoBufferPool where
    toGValue :: VideoBufferPool -> IO GValue
toGValue VideoBufferPool
o = do
        GType
gtype <- IO GType
c_gst_video_buffer_pool_get_type
        VideoBufferPool -> (Ptr VideoBufferPool -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr VideoBufferPool
o (GType
-> (GValue -> Ptr VideoBufferPool -> IO ())
-> Ptr VideoBufferPool
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr VideoBufferPool -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO VideoBufferPool
fromGValue GValue
gv = do
        Ptr VideoBufferPool
ptr <- GValue -> IO (Ptr VideoBufferPool)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr VideoBufferPool)
        (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
        
    

-- | 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 :: (MonadIO m, IsVideoBufferPool o) => o -> m VideoBufferPool
toVideoBufferPool :: o -> m VideoBufferPool
toVideoBufferPool = IO VideoBufferPool -> m VideoBufferPool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
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'
unsafeCastTo ManagedPtr VideoBufferPool -> VideoBufferPool
VideoBufferPool

#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.MethodInfo 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

#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 :: m VideoBufferPool
videoBufferPoolNew  = IO VideoBufferPool -> m VideoBufferPool
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 (m :: * -> *) a. Monad m => a -> m a
return VideoBufferPool
result'

#if defined(ENABLE_OVERLOADING)
#endif